Closed rogue-agent closed 2 years ago
It seems that the issue is due to GTK4 deprecated margin property with margin-*(e.g. margin-top, margin-bottom) instead. Articles: https://docs.gtk.org/gtk4/migrating-3to4.html https://discourse.gnome.org/t/why-did-margin-property-disappeared-in-gtk4/5530 I don't have Gnome 42 environment, could you manually modify prefs.js containing margin keyword and and see whether it works? Thanks.
Thank you @pbxqdown for the suggestion, I changed "margin" to "margin-start" for example. But I got the following error:
TypeError: ModifierKeyLabel.set_line_wrap is not a function
Stack trace:
_init@/home/igolskyi/.local/share/gnome-shell/extensions/transparent-window@pbxqdown.github.com/prefs.js:64:22
wrapper@resource:///org/gnome/gjs/modules/script/_legacy.js:83:27
buildPrefsWidget@/home/igolskyi/.local/share/gnome-shell/extensions/transparent-window@pbxqdown.github.com/prefs.js:98:16
_init@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:32:44
ExtensionPrefsDialog@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:10:4
OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:129:33
asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:115:22
run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:186:20
main@resource:///org/gnome/Shell/Extensions/js/main.js:22:13
run@resource:///org/gnome/gjs/modules/script/package.js:206:19
start@resource:///org/gnome/gjs/modules/script/package.js:190:8
@/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17
Unfortunately, it seems that this will also not be the last error.
P.S. Fantastic, now the extension is working even with this error. Thank you.
Thanks @igolskyi for helping with this. It seems that gtk4 renames set_line_wrap with set_wrap, maybe you can try and see whether it fixes the issue? https://docs.gtk.org/gtk4/method.Label.set_wrap.html
Yes, I renamed set_line_wrap with set_wrap.
Next error:
TypeError: ModifierKeyBox.pack_start is not a function
Stack trace:
_init@/home/igolskyi/.local/share/gnome-shell/extensions/transparent-window@pbxqdown.github.com/prefs.js:74:20
wrapper@resource:///org/gnome/gjs/modules/script/_legacy.js:83:27
buildPrefsWidget@/home/igolskyi/.local/share/gnome-shell/extensions/transparent-window@pbxqdown.github.com/prefs.js:98:16
_init@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:32:44
ExtensionPrefsDialog@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:10:4
OpenExtensionPrefsAsync/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:129:33
asyncCallback@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:115:22
run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:186:20
main@resource:///org/gnome/Shell/Extensions/js/main.js:22:13
run@resource:///org/gnome/gjs/modules/script/package.js:206:19
start@resource:///org/gnome/gjs/modules/script/package.js:190:8
@/usr/share/gnome-shell/org.gnome.Shell.Extensions:1:17
Probably I'm trying to rename to gtk_box_prepend() as described here: https://docs.gtk.org/gtk4/migrating-3to4.html#adapt-to-gtkbox-api-changes
No, it's not helped
TypeError: ModifierKeyBox.gtk_box_prepend is not a function
maybe try ModifierKeyBox.box_prepend, or ModifierKeyBox.prepend?
So prepend worked.
Next error: TypeError: ModifierKeyBox.add is not a function
gosh gtk4 changes everything😂 maybe try ModifierKeyBox.append? the definition is in: https://docs.gtk.org/gtk4/class.Box.html
So I replaced .add() with .append()
Next, I commented this line:
// widget.show_all();
Because: The function gtk_widget_show_all(), the GtkWidget:no-show-all property, and its getter and setter have been removed in GTK 4, so you should stop using them.
And finally no more errors :)
All changes I've tested for GNOME Shell 42.0:
margin --> "margin-start"
set_line_wrap() --> set_wrap()
pack_start() --> prepend()
add() --> append()
// widget.show_all();
Thanks @igolskyi This is awesome! I saw that GTK4 is included since Gnome40: https://help.gnome.org/misc/release-notes/40.0/developers.html.en so maybe this will fix all Gnome40 upwards version?
Most likely yes, but we need more feedback on other versions of Gnome40.
I also think that it will not be worse if you update the extension and more people can test it :)
Since I haven't upgraded since gnome 3.36 yet, i'm not able to verify.. Please let me know if the extension works on Gnome40 if you have used it. There is a version control feature of the extension: https://github.com/pbxqdown/gnome-shell-extension-transparent-window/blob/239529a38dc6aeb5c645c0692b9cf1e52b7c0a4e/extension.js#L112 Maybe we can define a gnome_at_least_40_1 variable to make it compatible with both GNOME3X and Gnome 4X. Version schema of Gnome 40:https://www.zdnet.com/article/gnome-drops-3-x-versioning-to-shift-to-gnome-40-for-next-release/
All the changes I've checked for GNOME Shell 42.0:
let gnome_at_least_40_1;
...
...
function init() {
...
...
gnome_at_least_3_38 = isVersionGreaterOrEqual(3, 38);
gnome_at_least_40_1 = isVersionGreaterOrEqual(40, 1);
}
...
...
if (gnome_at_least_40_1) {
After restart's Alt+F2 r
extension still works.
Nice! Could you submit a MR for this? It seems that there is no version check for prefs.js yet
Good idea. Could you please review for https://github.com/pbxqdown/gnome-shell-extension-transparent-window/pull/18
P.S. //TODO:support multi-monitor https://github.com/pbxqdown/gnome-shell-extension-transparent-window/blob/master/extension.js#L117 would be amazing ;)
Good idea. Could you please review for #18
P.S. //TODO:support multi-monitor https://github.com/pbxqdown/gnome-shell-extension-transparent-window/blob/master/extension.js#L117 would be amazing ;)
Yep, i think it is doable, but the GTK API is ever-changing and hard to find reference😂
@pbxqdown I deleted this extension with our local changes. And installed the new version. All works on Gnome 42
@rogue-agent could you please check if the new version works?
Disabled all other window decorations, extensions and themes.
@rogue-agent try change log verbose level to "Debug" and sudo journalctl -f /usr/bin/gnome-shell
may print more debug details
It recognizes me pressing Ctrl + V and other button combinations.
Yes so the hotkey detection works. I saw your hotkey code is set to 14. I think you are not pressing the correct hotkey?
Is this hotkey activated? I thought this was basic transparency like in Windows. What hotkey combination?
The default modifier key is Alt which has modifier key 8. You can press combination of key on preference window and it will change accordingly. Following are list of modifier key code(https://man7.org/linux/man-pages/man5/keymaps.5.html): Shift 1 AltGr 2 Control 4 Alt 8 ShiftL 16 ShiftR 32 CtrlL 64 CtrlR 128 CapsShift 256
I pressed them in order you wrote. I don't know what there is control and shift if there is Control and Shift for left and right in the end.
if you want ctrl+shift, the modifier key would be 1+4 which is 5. You can then set 5 as the keycode and hover on a window, press ctrl+shift and scroll the mouse wheel
I don't know. I set it to 18 for AltGr+ShiftL, I'm on a laptop so I used two finger scroll. Nothing happened
maybe try default setting with Alt key(code is 8)? Under normal condition there would be logs of:
[DEBUG][TransparentWindow] Modifier key pressed, listening to scroll
It worked. I was able to scroll with the touchpad and the window changed opacity. Extensions window, Lutris, Filezilla, Geary, Calendar, Junction, Fragments, Banking, NewsFlash, EasySSH and Authenticator didn't work. I haven't tested others.
Hm... In my case https://github.com/pbxqdown/gnome-shell-extension-transparent-window/issues/17#issuecomment-1140498627 the key code of left Alt
is 24 (Ubuntu 22.04, Gnome-Shell 42)
@igolskyi Yep guess different regions have different keyboard layout/code. @rogue-agent Awesome so we can verify the extension work on Gnome42.
@pbxqdown also, check if nothing is broken on older versions.
Yes, the extension works on my GNOME 3.36. And older version's code keeps untouched.
@pbxqdown probably, you can close this issue :)
@igolskyi I suddenly have an idea why your Alt key code is 24. Do you have a keyboard with numlock? Since numlock's keycode is 16, 16(NUMSlock)+8(ALT) would get 24. This PR may mask off numlock key: https://github.com/pbxqdown/gnome-shell-extension-transparent-window/pull/19
@pbxqdown Yes, my laptop with numlock :)
System information
You can obtain the GNOME version by:
Describe the problem
Downloaded from extensions page(latest) (latest) and manually installed
Source code / logs