You are not logged in.
Playing with my Sway configuration and I have run into something I cannot figure out.
I have my system set up with many bindsym commands to map things to my taste.
I use a bindcode to detect the press and release of $mod1 to launch rofi (or kill it if it is already active) allowing me to pop up a menu with the "Window" key.
Works great.
But, I have couple keys that do not generate key symbols, only codes. wev reports one of these keys as a Super_L press, followed by a Shift_L press, then release, then release of the Super_L. The legend on the key itself indicates it ts to control the camera; but it is not hardwired to do so, so nothing really happens. How would I go about catching two keycodes like this? I can catch one as I do with rofi launch, but I don't need to know the state of any other keys or the sequence in which they are pressed when I do this.
My inclination would be to use modes in which the first press changes to a mode looking for what comes next, but that seems like a deep rabbit hole. Am I barking up the wrong tree? Or am I missing something obvious?
Documentation on bindcode in Sway is a bit thin.
Last edited by ewaller (2024-01-23 20:41:22)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Am assuming you are running xorg-xwayland as you mentioned rofi. I switched to wofi to use pure wayland session.
Use wev like you to find keybinds for Sway, modes are a royal pain! I dumped resize in i3 years ago.
Thinking out loud here I would use something like
bindsym --release Mod4+d exec wofiNot sure what you mean by some keys do not have codes, we talking multimedia or [Function] special keys?
Mr Green
Offline
Hey, good to hear from you, Actually, my rofi is rofi-lbonn-wayland-git from the AUR, a Wayland fork.
Wofi did not roll my socks up and down when I tried it. Maybe I should revisit that one day.
In any event,
I do have this line in my configuration, and it works perfectly:
bindcode --release 133 exec pkill rofi || rofi -show combiThe idea being if I just press and release the "Window" key, it pops up the rofi menu, or any rofi menu is open, then close it. By this, I mean I have a Bluetooth menu and a Clipboard menu I can open using different keystrokes. That bindcode will close them too should they be open.
Yes, it is a function key, per se. There are three keys on the keyboard that are useful in Windows (kind of an oxymoron, but I digress). One of those keys it to lock a session. It generates Mod4-L.. Easy peasy, it gets mapped to swaylock
The one with a picture of a camera with a no circle imposed on it generates XF86WebCam, makes sense and I can catch that.
One, that contains a dotted line bordered rectangle and an icon of a pair os scissors generates the following sequence in wev:
[14: wl_keyboard] key: serial: 15944; time: 79296401; key: 133; state: 1 (pressed)
sym: Super_L (65515), utf8: ''
[14: wl_keyboard] modifiers: serial: 0; group: 0
depressed: 00000040: Mod4
latched: 00000000
locked: 00000000
[14: wl_keyboard] key: serial: 15946; time: 79296406; key: 50; state: 1 (pressed)
sym: Shift_L (65505), utf8: ''
[14: wl_keyboard] modifiers: serial: 0; group: 0
depressed: 00000041: Shift Mod4
latched: 00000000
locked: 00000000
[14: wl_keyboard] key: serial: 15948; time: 79296430; key: 50; state: 0 (released)
sym: Shift_L (65505), utf8: ''
[14: wl_keyboard] modifiers: serial: 0; group: 0
depressed: 00000040: Mod4
latched: 00000000
locked: 00000000
[14: wl_keyboard] key: serial: 15950; time: 79296445; key: 133; state: 0 (released)
sym: Super_L (65515), utf8: ''How does one capture that? It the equivalent of pressing and releasing Window - Shift (two modifiers) without any additional character that generates an actual symbol that can be caught by bindsym I am pretty sure:
bindsym Mod4+Super_Lis not going to fly.
That leaves only bincode
And, I agree, modes are a major PITA -- I only have the resize mode, but I have extended it to use my arrow keys.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Emmm Mod1 + Super_L....
Anyway what I have read:
https://www.codejam.info/2022/04/xmodmaprc-wayland.html
Think it will be a bit of a rabbit hole!
Just checked my output from wev and I have four keys that show XF86TouchpadToggle ;-(
# Resize window with arrow keys
bindsym $mod+Control+Left resize shrink width 10px or 10ppt
bindsym $mod+Control+Down resize grow height 10px or 10ppt
bindsym $mod+Control+Up resize shrink height 10px or 10ppt
bindsym $mod+Control+Right resize grow width 10px or 10pptMessy but for how often I resize windows it is enough....
Mr Green
Offline
Still fightingplaying with this.
After further experiments, I am able to simplify catching just the mod key press and release with a bindsym rather than a bindcode
#bindcode --release 133 exec pkill wofi || wofi --show drun
bindsym --release Super_L exec pkill wofi || wofi --show drunBut I still cannot catch the 'cut' key which generates the shift-mod press and release sequence from post #3
#These do not work :(
bindsym Shift_L+Super_L exec clipman pick -t wofi
bindsym Shift_L+Super_L --release exec clipman pick -t wofi
bindcode Shift_L + -133 --release exec clipman pick -t wofiBut this works, so it is not the exec part.
bindsym $mod+c exec clipman pick -t wofiAny thoughts six months on?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
This works for me:
bindsym Shift_L exec touch /home/empty/testI have the same weird scissors key (alternative function for F6), it also returns the same output in wev, the above keybind results in ~/test being created when it is pressed.
Jin, Jîyan, Azadî
Offline
bindsym Shift_L exec touch /home/empty/testI have the same weird scissors key (alternative function for F6), it also returns the same output in wev, the above keybind results in ~/test being created when it is pressed.
That was close, but the left shift key triggered the event.
Believe it or not, this does work ![]()
bindsym Shift_L+Mod4 exec clipman pick -t wofiNothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline