Skip to content

Commit 50e01ed

Browse files
committed
try to fix Directly switch source with click
Signed-off-by: Hollow Man <hollowman@opensuse.org>
1 parent 99e01aa commit 50e01ed

10 files changed

Lines changed: 191 additions & 152 deletions

File tree

customize-ibus@hollowman.ml/extension.js

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,30 +1274,69 @@ const IBusTrayClickSwitch = GObject.registerClass(
12741274
);
12751275
}
12761276

1277+
_disconnectClickHandler() {
1278+
if (
1279+
this._clickRecognizeID &&
1280+
InputSourceIndicator?._clickGesture?.disconnect instanceof
1281+
Function
1282+
) {
1283+
InputSourceIndicator._clickGesture.disconnect(
1284+
this._clickRecognizeID
1285+
);
1286+
this._clickRecognizeID = 0;
1287+
}
1288+
if (this._buttonPressID) {
1289+
InputSourceIndicator.disconnect(this._buttonPressID);
1290+
this._buttonPressID = 0;
1291+
}
1292+
}
1293+
1294+
_activateInputMode() {
1295+
IBusManager.activateProperty(INPUTMODE, IBus.PropState.CHECKED);
1296+
InputSourceIndicator.menu.close();
1297+
}
1298+
1299+
_connectClickGesture(keyNum) {
1300+
const clickGesture = InputSourceIndicator?._clickGesture;
1301+
if (!clickGesture || !(clickGesture.connect instanceof Function))
1302+
return false;
1303+
1304+
this._clickRecognizeID = clickGesture.connect(
1305+
'recognize',
1306+
gesture => {
1307+
const button =
1308+
gesture.get_button instanceof Function
1309+
? gesture.get_button()
1310+
: 0;
1311+
const matches =
1312+
button === keyNum ||
1313+
(keyNum === 2 && (button === 2 || button === 3));
1314+
if (matches) this._activateInputMode();
1315+
}
1316+
);
1317+
return true;
1318+
}
1319+
12771320
set traysswitchkey(traysswitchkey) {
1278-
if (this._buttonPressID)
1279-
(InputSourceIndicator.disconnect(this._buttonPressID),
1280-
(this._buttonPressID = 0));
12811321
let keyNum = traysswitchkey === 0 ? 1 : 3;
12821322
if (_isWaylandCompositor()) keyNum = traysswitchkey === 0 ? 1 : 2;
1323+
this._disconnectClickHandler();
1324+
1325+
// GNOME 50+ panel buttons are activated through Clutter.ClickGesture
1326+
// and may not emit button-press-event reliably.
1327+
if (this._connectClickGesture(keyNum)) return;
1328+
12831329
this._buttonPressID = InputSourceIndicator.connect(
12841330
'button-press-event',
1285-
function (actor, event) {
1286-
if (_eventHasButton(event, keyNum)) {
1287-
IBusManager.activateProperty(
1288-
INPUTMODE,
1289-
IBus.PropState.CHECKED
1290-
);
1291-
InputSourceIndicator.menu.close();
1292-
}
1331+
(_actor, event) => {
1332+
if (_eventHasButton(event, keyNum))
1333+
this._activateInputMode();
12931334
}
12941335
);
12951336
}
12961337

12971338
destroy() {
1298-
if (this._buttonPressID)
1299-
(InputSourceIndicator.disconnect(this._buttonPressID),
1300-
(this._buttonPressID = 0));
1339+
this._disconnectClickHandler();
13011340
}
13021341
}
13031342
);

customize-ibus@hollowman.ml/locale/customize-ibus.pot

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# SOME DESCRIPTIVE TITLE.
22
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3-
# This file is distributed under the same license as the UcustomizeU ibus package.
3+
# This file is distributed under the same license as the Customize Ibus package.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55
#
66
#, fuzzy
77
msgid ""
88
msgstr ""
9-
"Project-Id-Version: UcustomizeU ibus 93\n"
9+
"Project-Id-Version: Customize Ibus 93\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-02-27 19:40+0200\n"
11+
"POT-Creation-Date: 2026-02-28 06:32+0200\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,63 +17,63 @@ msgstr ""
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

20-
#: extension.js:1621
20+
#: extension.js:1660
2121
msgid "IBus panel service connected!"
2222
msgstr ""
2323

24-
#: extension.js:2230
24+
#: extension.js:2269
2525
msgid "loading light user theme for IBus:"
2626
msgstr ""
2727

28-
#: extension.js:2241
28+
#: extension.js:2280
2929
msgid "loading dark user theme for IBus:"
3030
msgstr ""
3131

32-
#: extension.js:2247
32+
#: extension.js:2286
3333
msgid "loading default theme for IBus"
3434
msgstr ""
3535

36-
#: extension.js:2465
36+
#: extension.js:2504
3737
msgid "loading background for IBus:"
3838
msgstr ""
3939

40-
#: extension.js:2478
40+
#: extension.js:2517
4141
msgid "remove custom background for IBus"
4242
msgstr ""
4343

44-
#: extension.js:3073
44+
#: extension.js:3112
4545
msgid "Starting / Restarting IBus..."
4646
msgstr ""
4747

48-
#: extension.js:3102
48+
#: extension.js:3141
4949
msgid "Copy Emoji"
5050
msgstr ""
5151

52-
#: extension.js:3123 prefs.js:1689 prefs.js:2144
52+
#: extension.js:3162 prefs.js:1689 prefs.js:2144
5353
msgid "Customize IBus"
5454
msgstr ""
5555

56-
#: extension.js:3144 prefs.js:312 prefs.js:555
56+
#: extension.js:3183 prefs.js:312 prefs.js:555
5757
msgid "IBus Preferences"
5858
msgstr ""
5959

60-
#: extension.js:3165 extension.js:3178 prefs.js:559
60+
#: extension.js:3204 extension.js:3217 prefs.js:559
6161
msgid "IBus Version"
6262
msgstr ""
6363

64-
#: extension.js:3204
64+
#: extension.js:3243
6565
msgid "Restart"
6666
msgstr ""
6767

68-
#: extension.js:3233
68+
#: extension.js:3272
6969
msgid "Restarting IBus..."
7070
msgstr ""
7171

72-
#: extension.js:3252
72+
#: extension.js:3291
7373
msgid "Quit"
7474
msgstr ""
7575

76-
#: extension.js:3266
76+
#: extension.js:3305
7777
msgid "Exiting IBus..."
7878
msgstr ""
7979

customize-ibus@hollowman.ml/locale/eo/LC_MESSAGES/customize-ibus.po

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,63 @@ msgstr ""
1818
"Plural-Forms: nplurals=2; plural=n != 1;\n"
1919
"X-Generator: Weblate 5.7-dev\n"
2020

21-
#: extension.js:1621
21+
#: extension.js:1660
2222
msgid "IBus panel service connected!"
2323
msgstr ""
2424

25-
#: extension.js:2230
25+
#: extension.js:2269
2626
msgid "loading light user theme for IBus:"
2727
msgstr "ŝargante propran helan etoson por IBus:"
2828

29-
#: extension.js:2241
29+
#: extension.js:2280
3030
msgid "loading dark user theme for IBus:"
3131
msgstr "ŝargante propran malhelan etoson por IBus:"
3232

33-
#: extension.js:2247
33+
#: extension.js:2286
3434
msgid "loading default theme for IBus"
3535
msgstr "ŝargante implicitan etoson por IBus"
3636

37-
#: extension.js:2465
37+
#: extension.js:2504
3838
msgid "loading background for IBus:"
3939
msgstr "ŝargante fonon por IBus:"
4040

41-
#: extension.js:2478
41+
#: extension.js:2517
4242
msgid "remove custom background for IBus"
4343
msgstr "forigi propran fonon por IBus"
4444

45-
#: extension.js:3073
45+
#: extension.js:3112
4646
msgid "Starting / Restarting IBus..."
4747
msgstr "Lanĉante/relanĉante IBus…"
4848

49-
#: extension.js:3102
49+
#: extension.js:3141
5050
msgid "Copy Emoji"
5151
msgstr ""
5252

53-
#: extension.js:3123 prefs.js:1689 prefs.js:2144
53+
#: extension.js:3162 prefs.js:1689 prefs.js:2144
5454
msgid "Customize IBus"
5555
msgstr "Adapti IBus"
5656

57-
#: extension.js:3144 prefs.js:312 prefs.js:555
57+
#: extension.js:3183 prefs.js:312 prefs.js:555
5858
msgid "IBus Preferences"
5959
msgstr "Agordoj pri IBus"
6060

61-
#: extension.js:3165 extension.js:3178 prefs.js:559
61+
#: extension.js:3204 extension.js:3217 prefs.js:559
6262
msgid "IBus Version"
6363
msgstr "Versio de IBus"
6464

65-
#: extension.js:3204
65+
#: extension.js:3243
6666
msgid "Restart"
6767
msgstr "Relanĉi"
6868

69-
#: extension.js:3233
69+
#: extension.js:3272
7070
msgid "Restarting IBus..."
7171
msgstr "Relanĉante IBus…"
7272

73-
#: extension.js:3252
73+
#: extension.js:3291
7474
msgid "Quit"
7575
msgstr "Forlasi"
7676

77-
#: extension.js:3266
77+
#: extension.js:3305
7878
msgid "Exiting IBus..."
7979
msgstr "Forlasante IBus…"
8080

customize-ibus@hollowman.ml/locale/fr/LC_MESSAGES/customize-ibus.po

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,63 @@ msgstr ""
1818
"Plural-Forms: nplurals=2; plural=n > 1;\n"
1919
"X-Generator: Weblate 5.7-dev\n"
2020

21-
#: extension.js:1621
21+
#: extension.js:1660
2222
msgid "IBus panel service connected!"
2323
msgstr ""
2424

25-
#: extension.js:2230
25+
#: extension.js:2269
2626
msgid "loading light user theme for IBus:"
2727
msgstr ""
2828

29-
#: extension.js:2241
29+
#: extension.js:2280
3030
msgid "loading dark user theme for IBus:"
3131
msgstr ""
3232

33-
#: extension.js:2247
33+
#: extension.js:2286
3434
msgid "loading default theme for IBus"
3535
msgstr ""
3636

37-
#: extension.js:2465
37+
#: extension.js:2504
3838
msgid "loading background for IBus:"
3939
msgstr ""
4040

41-
#: extension.js:2478
41+
#: extension.js:2517
4242
msgid "remove custom background for IBus"
4343
msgstr ""
4444

45-
#: extension.js:3073
45+
#: extension.js:3112
4646
msgid "Starting / Restarting IBus..."
4747
msgstr ""
4848

49-
#: extension.js:3102
49+
#: extension.js:3141
5050
msgid "Copy Emoji"
5151
msgstr ""
5252

53-
#: extension.js:3123 prefs.js:1689 prefs.js:2144
53+
#: extension.js:3162 prefs.js:1689 prefs.js:2144
5454
msgid "Customize IBus"
5555
msgstr ""
5656

57-
#: extension.js:3144 prefs.js:312 prefs.js:555
57+
#: extension.js:3183 prefs.js:312 prefs.js:555
5858
msgid "IBus Preferences"
5959
msgstr ""
6060

61-
#: extension.js:3165 extension.js:3178 prefs.js:559
61+
#: extension.js:3204 extension.js:3217 prefs.js:559
6262
msgid "IBus Version"
6363
msgstr ""
6464

65-
#: extension.js:3204
65+
#: extension.js:3243
6666
msgid "Restart"
6767
msgstr ""
6868

69-
#: extension.js:3233
69+
#: extension.js:3272
7070
msgid "Restarting IBus..."
7171
msgstr ""
7272

73-
#: extension.js:3252
73+
#: extension.js:3291
7474
msgid "Quit"
7575
msgstr ""
7676

77-
#: extension.js:3266
77+
#: extension.js:3305
7878
msgid "Exiting IBus..."
7979
msgstr ""
8080

0 commit comments

Comments
 (0)