Skip to content

Commit

Permalink
fix: don't open browser on shell reload
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Mar 6, 2023
1 parent 0625604 commit cd752fa
Show file tree
Hide file tree
Showing 35 changed files with 65 additions and 47 deletions.
2 changes: 1 addition & 1 deletion resources/po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "الوضع المخفي"
msgid "Settings"
msgstr "الإعدادات"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Режим \"инкогнито\""
msgid "Settings"
msgstr "Настройки"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
14 changes: 3 additions & 11 deletions resources/po/cs.po
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Amerey.eu <[email protected]>\n"
"Language-Team: \n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.1.1\n"
"X-Generator: fill-pot-po/2.1.9\n"

#: src/components/indicator/clearHistoryDialog.ts:23
msgid "Cancel"
Expand Down Expand Up @@ -39,7 +31,7 @@ msgstr "Anonymní režim"
msgid "Settings"
msgstr "Nastavení"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr "Bez popisu"

Expand Down Expand Up @@ -557,4 +549,4 @@ msgstr "Barva"

#: src/utils/ui.ts:13
msgid "Pano"
msgstr "Pano"
msgstr "Pano"
2 changes: 1 addition & 1 deletion resources/po/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognitotilstand"
msgid "Settings"
msgstr "Indstillinger"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognito-Modus"
msgid "Settings"
msgstr "Einstellungen"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/el.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Ανώνυμης"
msgid "Settings"
msgstr "Ρυθμίσεις"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Incognito Mode"
msgid "Settings"
msgstr "Settings"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Modo incógnito"
msgid "Settings"
msgstr "Configuración"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/et.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognito režiim"
msgid "Settings"
msgstr "Seaded"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Incognito-tila"
msgid "Settings"
msgstr "Asetukset"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Mode incognito"
msgid "Settings"
msgstr "Paramètres"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/he.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "מצב גלישה בסתר"
msgid "Settings"
msgstr "הגדרות"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr ""
msgid "Settings"
msgstr ""

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognitómód"
msgid "Settings"
msgstr "Beállítások"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/is.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Huliðsstilling"
msgid "Settings"
msgstr "Stillingar"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Modalità di navigazione in incognito"
msgid "Settings"
msgstr "Impostazioni"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "シークレットモード"
msgid "Settings"
msgstr "設定"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/ko.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "시크릿 모드"
msgid "Settings"
msgstr "설정"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Incognitomodus"
msgid "Settings"
msgstr "Voorkeuren"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/no.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognitomodus"
msgid "Settings"
msgstr "Innstillinger"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/oc.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Mòde incognito"
msgid "Settings"
msgstr "Paramètres"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ msgstr ""
msgid "New shortcut"
msgstr ""

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Tryb Incognito"
msgid "Settings"
msgstr "Ustawienia"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Modo de navegação anónima"
msgid "Settings"
msgstr "Configurações"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Modo anônimo"
msgid "Settings"
msgstr "Configurações"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/ro.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Modul incognito"
msgid "Settings"
msgstr "Setări"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Режим инкогнито"
msgid "Settings"
msgstr "Настройки"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/sk.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Režim inkognito"
msgid "Settings"
msgstr "Nastavenia"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Inkognitoläge"
msgid "Settings"
msgstr "Inställningar"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/tr.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Gizli Mod"
msgid "Settings"
msgstr "Ayarlar"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Режим анонімного перегляду"
msgid "Settings"
msgstr "Параметри"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/vi.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "Chế Độ Ẩn Danh"
msgid "Settings"
msgstr "Cài Đặt"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion resources/po/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ msgstr "隐身模式"
msgid "Settings"
msgstr "设置"

#: src/components/linkPanoItem.ts:37
#: src/components/linkPanoItem.ts:45
msgid "No Description"
msgstr ""

Expand Down
32 changes: 29 additions & 3 deletions src/components/linkPanoItem.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { ActorAlign } from '@gi-types/clutter10';
import {
ActorAlign,
ButtonEvent,
EVENT_PROPAGATE,
KEY_ISO_Enter,
KEY_KP_Enter,
KEY_Return,
KeyEvent,
} from '@gi-types/clutter10';
import { File, Settings } from '@gi-types/gio2';
import { uri_parse, UriFlags } from '@gi-types/glib2';
import { BoxLayout, Label } from '@gi-types/st1';
import { PanoItem } from '@pano/components/panoItem';
import { ClipboardContent, clipboardManager, ContentType } from '@pano/utils/clipboardManager';
import { DBItem } from '@pano/utils/db';
import { registerGObjectClass } from '@pano/utils/gjs';
import { _, getCachePath, getCurrentExtension, openUrlInBrowser as openLinkInBrowser } from '@pano/utils/shell';
import { _, getCachePath, getCurrentExtension, openLinkInBrowser } from '@pano/utils/shell';

const DEFAULT_LINK_PREVIEW_IMAGE_NAME = 'link-preview.svg';

Expand Down Expand Up @@ -129,8 +137,26 @@ export class LinkPanoItem extends PanoItem {
value: this.dbItem.content,
}),
);
if (this.settings.get_boolean('open-links-in-browser')) {
}

override vfunc_key_press_event(event: KeyEvent): boolean {
super.vfunc_key_press_event(event);
if (
this.settings.get_boolean('open-links-in-browser') &&
(event.keyval === KEY_Return || event.keyval === KEY_ISO_Enter || event.keyval === KEY_KP_Enter)
) {
openLinkInBrowser(this.dbItem.content);
}

return EVENT_PROPAGATE;
}

override vfunc_button_release_event(event: ButtonEvent): boolean {
super.vfunc_button_release_event(event);
if (event.button === 1 && this.settings.get_boolean('open-links-in-browser')) {
openLinkInBrowser(this.dbItem.content);
}

return EVENT_PROPAGATE;
}
}
2 changes: 1 addition & 1 deletion src/utils/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export function debounce(func, wait) {
};
}

export const openUrlInBrowser = (url: string) => {
export const openLinkInBrowser = (url: string) => {
try {
app_info_launch_default_for_uri(url, null);
} catch (e) {
Expand Down

0 comments on commit cd752fa

Please sign in to comment.