Last active
March 14, 2024 13:56
-
-
Save bulatenkom/c2946537f11c817e5add9002cc231594 to your computer and use it in GitHub Desktop.
[Xorg, KDE, custom shortcuts] Script to focus/hide separate chrome window with opened ChatGPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
get_active_desktop_num() { | |
wmctrl -d | awk '/*/{print NR-1}' | |
} | |
if wmctrl -l | grep -Eq "$(get_active_desktop_num) $(hostname) ChatGPTxyz"; then | |
# Hide (move window to unused virtual desktop) | |
wmctrl -r ChatGPTxyz -t 5 | |
else | |
# Focus (move window to active virtual desktop and bring focus) | |
wmctrl -r ChatGPTxyz -t "$(get_active_desktop_num)" | |
wmctrl -a ChatGPTxyz | |
fi |
I bind this script to '+' button on numpad, since all buttons on numpad except numbers are unused.
KDE Custom Shortcuts executes script much faster, than simple Shortcuts (few seconds delay).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lock chrome window to ChatGPTxyz name: Chrome ⟶ (3 dots) ⟶ More tools ⟶ Name window...
Posted solution: Xorg only.
Following third party tools may help achieve the same behavior:
https://github.com/ReimuNotMoe/ydotool (xorg, wayland)
https://github.com/atx/wtype (wayland)