Fn+ function shortcuts 2wm (solved)

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Fn+ function shortcuts 2wm (solved)

Unread post by catfood » Mon Jul 13, 2020 9:32 am

I want to set keyboard shortcuts for Master Volume back to Fn3 and Fn4 across the system.
(edited to remove initial misdiagnosing of potential causes on my part :D )

I looked back, and had got to a similar issue in my Make Install 2wm thread before with adding Mod4, but now trying to understand why 2wm is auto-voiding Fn keys.
I'm running BBQ Break 4.2.0-trunk-586.
Once I installed 2wm on top, can't use default (keyboard printed)Fn keybindings there.
They work as described in Openbox (just rechecked). Looked in Openbox config files, but nothing there implicitly making Fn Keybindings for Openbox alone. I couldn't really see anything in 2wm's small code being able to override wherever these default key bindings are. I nano read through every 2wm file, I don't know what I'm looking at per say, but the only things with keys/keybindings are all based on a modkey of Alt, or Alt+Shift. Nothing I saw that sounded like it would override default Fn key uses...

I ran XEV and Fn3or4 show :

Code: Select all

KeyPress event, serial 32, sythetic No, window 0x3a00001,
     root 0x96, subw 0x0, time 2523450, (434,557), root:(435,558),
     state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolue), same_screen YES,
     XLookupString gives 0 bytes:
     XFilterEvent returns: False
So Fn keys work in Openbox, and seem to come from Debian doing default hardware control. 2wm somehow cuts the Functions off. Despite XEV showing a correct output for them, ie XF86AudioRaiseVolume, they don't actually perform their function.

Recommended fixes? I'll accept Right, and/or Easy options...
Somehow add Fn shortcuts to 2wm config(or does someone know how it's non-config files kill Fn key)?
Somewhere else in base Debian files where Fn keybinds might be stored, somehow make those override all window managers?

Long search short, I have no idea what to do now, lol. I'm in over my head as usual, but I tried to do as much footwork as possible so you guys don't have to completely babysit me :D
Last edited by catfood on Fri Jul 17, 2020 3:56 am, edited 1 time in total.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Alsa keyboard volume shortcuts

Unread post by catfood » Mon Jul 13, 2020 9:35 am

(delete post)
Last edited by catfood on Fri Jul 17, 2020 7:03 am, edited 1 time in total.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Alsa keyboard volume shortcuts

Unread post by catfood » Mon Jul 13, 2020 11:35 am

Curious if this would work, or close to the right idea? but again, not really sure what I'm doing...
I don't think this is the "Right" solution, but maybe an easy one?

I got hexcode keysymbols from xev:
Fn+3 = keysym 0x1008ff11 (XF86AudioLowerVolume)
Fn+4 = keysym 01x1008f13 (XF86AudioRaiseVolume)


So add them to 2wm define keys, something like this maybe?
Possible 2wm Fn34 volume fix.png
(The other two lines with 0, instead of modkey, are Mod4 and PRTSC hexcodes, and they work fine.)

Just unsure what to do with XF86 volume command part, if it needs more code to it?
I figured I'd ask before I try/break this idea (waiting on other comp to be clear so I can clonezilla backups before I make any more gamble changes today...)
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Alsa keyboard volume shortcuts

Unread post by wuxmedia » Mon Jul 13, 2020 9:33 pm

i had to do something weird to mine recently to get the vol up and down. damned if i recall what it was. might be confusing that with the brighness up and down though
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by catfood » Fri Jul 17, 2020 7:17 am

Tried above idea, edited until make no longer showed errors for Xf86Audio...

config.h lines:

Code: Select all

/* modifier                     key             function        argument */ \
{ 0,                            0x1008ff13,     spawn, \	{ .cmd = "XF86AudioRaiseVolume" } }, \
{ 0,                            0x1008ff11,     spawn, \	{ .cmd = "XF86AudioLowerVolume" } }, \
sudo make clean, sudo make:

Code: Select all

catfood@grill:~/installs/2wm-0.1$ sudo make
2wm build options:
CFLAGS   = -g -Wall -O2 -I. -I/usr/include -I/usr/X11R6/include -DVERSION="0.1"
LDFLAGS  = -g -L/usr/lib -lc -L/usr/X11R6/lib -lX11
CC       = cc
CC client.c
client.c: In function ‘updatetitle’:
client.c:340:4: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
  340 |    strncpy(c->name, *list, sizeof c->name);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
client.c:335:3: warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
  335 |   strncpy(c->name, (char *)name.value, sizeof c->name);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC event.c
event.c: In function ‘keypress’:
event.c:209:2: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
  209 |  keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
      |  ^~~~~~
In file included from 2wm.h:6,
                 from event.c:4:
/usr/include/X11/Xlib.h:1687:15: note: declared here
 1687 | extern KeySym XKeycodeToKeysym(
      |               ^~~~~~~~~~~~~~~~
CC main.c
CC util.c
CC view.c
CC -o 2wm
Errors come from client.c and event.c files. I haven't edited either of those, but thought I'd post this and ask before I Make Install so I don't run into further complications beyond my understanding.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by wuxmedia » Fri Jul 17, 2020 9:20 am

so xev recognises them?
I think my issue was that it didn't.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by catfood » Sat Jul 18, 2020 4:05 am

Yea, I figured out the XEV trick when trying to use Super_L. Super or Mod4 didn't work when put into the code ( I think C) of 2wm. The KeySym #s from XEV print a usable hex code for any key, or here, even combinations of keys. The fact it showed x86 volume commands after led me away from thinking it was an Alsa issue. I think I got the code lines right now, as no more errors for keybindings, but I'm afraid to test it yet, until I know what else is broken...

I just don't understand the other make errors. Trying not to break things further blindly trudging along, lol. I'm inches away from everything working again. Want a good solid backup, before I get wreckless again. Make install or dist-upgrade answering YES blindly seems to always bite me in the ass.

I emailed the dev at suckless, but since 2wm was dropped for full dwm support, not sure if I will get a reply. I'm hoping I see Chef on here again, he was a 2wm ninja with bleuets, and helped me understand a lot already about it...
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: Fn+ function shortcuts 2wm

Unread post by ivanovnegro » Sat Jul 18, 2020 8:35 pm

catfood wrote:
Sat Jul 18, 2020 4:05 am
Make install or dist-upgrade answering YES blindly seems to always bite me in the ass.
I know you run old or outdated versions of BBQ and this is old news but you need apt-listbugs and still you should read its output before hitting enter. ;)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by machinebacon » Sat Jul 18, 2020 9:38 pm

Hi,
I might be wrong, but

Code: Select all

.cmd = "XF86AudioRaiseVolume"
is not a command to spawn. Try something like

Code: Select all

/* modifier                     key             function        argument */ \
{ 0,                            0x1008ff13,     spawn, \	{ .cmd = "amixer set PCM 10%+" } }, \
{ 0,                            0x1008ff11,     spawn, \	{ .cmd = "amixer set PCM 10%-" } }, \
Just have a try.

There would be another way by using xbindkeys, for instance.
..gnutella..

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by catfood » Sun Jul 19, 2020 2:03 am

ivanovnegro wrote:
Sat Jul 18, 2020 8:35 pm
I know you run old or outdated versions of BBQ and this is old news but you need apt-listbugs and still you should read its output before hitting enter. ;)
Thank you, getting now. I managed to update 5yr old debian stable to Stretch this week, by just reading every warning and making adjustments along the way during dist-upgrade. I will gladly read anything that prevents me from killing things!
machinebacon wrote:
Sat Jul 18, 2020 9:38 pm

Code: Select all

/* modifier                     key             function        argument */ \
{ 0,                            0x1008ff13,     spawn, \	{ .cmd = "amixer set PCM 10%+" } }, \
{ 0,                            0x1008ff11,     spawn, \	{ .cmd = "amixer set PCM 10%-" } }, \
I'm not sure if my attempt at code works or not yet. Make gave errors on just function of XF86AudioRaiseVolume, so spawn,\ + XF86... was my next guess. Will definitely try this next.
With .cmd set to amixer? would amixer have to be open in a terminal, or is it always technically running in background? Half of me wanting to fix volume function is to prevent having to keep an amixer terminal open at all times...
(also, glad to see you back machinebacon!)

Wanted to make sure these Make errors weren't dangerous before I tried the make install.

Code: Select all

warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
from I'm guessing *list and *name making very long reference lines I assume?
and

Code: Select all

warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
which I have yet to find any info on...?
Those both came from default 2wm files and not the config.h that I'm in, but at least the string error wasn't present last Make, so worried something else doesn't like 2wm code now... Do I need to fix these, or are they just letting me know semi-useless facts about 2wm code?
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by machinebacon » Sun Jul 19, 2020 6:43 am

The make errors are harmless. Deprecated is just another term for outdated, but usually stuff should still be backward compatible.

Amixer is installed with aplay and called by many GUI mixers, too. Alsamixer is one of its frontends. You can run the command in terminal and see/hear what happens. The PCM can be changed to Master, too. It doesn't run in a terminal. With every keypress you issue a single command to change the volume and it immediately quits. It's more lightweight than any other mixer or volume-changer, trust me. It's not alsamixer, it's amixer.
..gnutella..

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by machinebacon » Sun Jul 19, 2020 6:51 am

Also see
https://stackoverflow.com/questions/983 ... detokeysym
https://bugs.chromium.org/p/chromium/is ... ?id=117210
So if you add
#include <X11/XKBlib.h>
and Change the
XKeycodeToKeysym(display_, key_code, 0);
to
XkbKeycodeToKeysym(display_, key_code, 0, 0)
you should get rid of the errors.

NO WARRANTY
..gnutella..

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by machinebacon » Sun Jul 19, 2020 6:55 am

Oh and just a little tip: use spectrwm 😂👍
..gnutella..

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by wuxmedia » Sun Jul 19, 2020 7:19 am

Jessie --> Stretch... my day job :) Stretch is (technically) EOL in a few weeks. better get to buster :D
this is on the servers though. almost everytime I do a dist-upg seems something new breaks in a clever unexpected way.
So far the worse is former sysadmins downgrading or excluding systemd, doesn't really work like that in buster now, could get away with it in previous versions. At least that was my understanding. (the bug was LVM didn't start at boot, so no data)
"Seek, and Ye shall find"
"Github | Chooons | Site"

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: Fn+ function shortcuts 2wm

Unread post by pidsley » Sun Jul 19, 2020 1:11 pm

I think stretch is oldstable until July 2022. I am not planning to upgrade my boxes until next year. https://wiki.debian.org/LTS

But yes, if I was doing a dist-upgrade today I'd go to buster. And you're right that with every new Debian version systemd gets more intrusive and harder to remove. I don't really care anymore. If I want to get away from systemd I use Alpine (busybox+openrc). Alpine is missing a few packages I like and it is harder to build things there (because musl) but I like it and am running it on this box right now. Still stretch on the main box and NFS servers downstairs.

"<blah> is deprecated" warnings never bothered me either. Most of my system is deprecated... (-:

And don't get me started on "OMG -- <blarg> hasn't been updated since 2017! Can't use that, must be obsolete!" -- no, it's just feature complete and no one is introducing new bugs.

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: Fn+ function shortcuts 2wm

Unread post by ivanovnegro » Sun Jul 19, 2020 4:38 pm

Oh man how I missed those more technical posts here. Almost crying. :) As I am not configuring any wm seriously anymore I almost forgot all the stuff you have to apply and how I did it before.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by wuxmedia » Sun Jul 19, 2020 7:30 pm

pidsley wrote:
Sun Jul 19, 2020 1:11 pm
And don't get me started on "OMG -- <blarg> hasn't been updated since 2017! Can't use that, must be obsolete!" -- no, it's just feature complete and no one is introducing new bugs.
Mostly true, personally quite happy for things to never change, fun fact - anything older than jessie (IIRC) cannot serve TLS 1.3 just can't get it unless you recompile openssl and so on. We have a lot of old boxes where we are just going to terminate SSL on another box with newer ciphers.
"Seek, and Ye shall find"
"Github | Chooons | Site"

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by machinebacon » Sun Jul 19, 2020 9:09 pm

You guys need CentOS, they're probably still sporting kernel 2.6 ;)
..gnutella..

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by catfood » Thu Jul 23, 2020 2:33 pm

Wow too many replies to quote.

Thank you Bacon, I will gladly read the links and do the suggested changes soon. And sweet, amixer running in the background without an open frontend is exactly what I was hoping to hear about; my purpose for all of this!

I tried spectrwm along with all the other tiling window managers you put on Cream for a bit. 2wm just seemed easiest to use, remember default keybindings, least keys to get jobs done, and less finger stretching than others. I know suckless gave up on it sometime in my absence, but I still love it! I do plan on compiling dwm for my desktop debian in the near future. The netbook is slow anyways, so the added 9 tags (extra "workspaces") of dwm is kind of a moot point. If I can't fit it on 2 screens with 2wm detach windows, the comp probably can't run it at the same time anyways, lol. Dwm for the desktop just keeps the same keybindings I'm already happy with, but adds a bit more where it can actually be of use. With time and boredom, I will probably try to live in every tiling wm for a while, prefer to stick in the suckless family until i "master" them though.

The stuff I have to do to get 2wm... (Ivanovnegro), yup... I'm enjoying trying to rework the mold and make 2wm perfect for me. As long as I'm not annoying everyone here with my dumb questions every other step, I plan to keep tweaking it further until it meets all my needs. If technical problems spark interest for others, I'm happy! I'm stubborn and like to ask why can't I make "it" do exactly what I want? The bbq mentality seems to be just that. Why do I need a desktop environment? If it's open-source, why can't I put whatever I want into my wm? Why can't I think of some other dumb random unnecessary change, lol? Collectively you all got me my dmenu on Super_L(mod4) to work. Restoring Fn keys for volume so I don't have to keep alsamixer open(nor use the mouse) is one step closer to perfect!

I asked about these warnings, because every time I ignore warnings lately, I break a whole lot of things it seems. After wasting A LOT of hours restoring from clonezilla in these past few weeks, I'm getting paranoid about ignoring any warning I don't understand...
I like the "feature complete" Pidsley :)
I'm not concerned with deprecated/outdated too much. I am concerned with security holes though, so anything I can fix or keep up to date, I prefer. I don't always know the difference or importance yet though.

Debian 9 EOL isn't yet, but somewhat soon IIRC. Glad to move passed Jessie on daily driver since repositories stopped working for it. I had issues with Ubunutu 20.04 based distros on my other daily's partition (similar to when 16.04 came out). So, I figured I'd milk Debian 9 and Xubuntu 18.04 as long as I safely can, then upgrade further once the "Zero Day" type bugs are more worked out.
Also, as wuxmedia said, Buster seems to be systemd intertwined on a new level. I'm just starting to learn about openrc and other alternatives, but as the general consensus here seems to be, avoid systemd. So trying to learn how to go down that route away from it...
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

User avatar
catfood
Bad Advice Dog
Posts: 146
Joined: Tue Oct 04, 2016 1:25 am
Location: F google
Contact:

Re: Fn+ function shortcuts 2wm

Unread post by catfood » Thu Jul 23, 2020 5:49 pm

I'm guessing

Code: Select all

warning: ‘strncpy’ specified bound 256 equals destination size [-Wstringop-truncation]
isn't of concern since no one commented on it...
machinebacon wrote:
Sun Jul 19, 2020 6:51 am
Also see
https://stackoverflow.com/questions/983 ... detokeysym
https://bugs.chromium.org/p/chromium/is ... ?id=117210
So if you add
#include <X11/XKBlib.h>
and Change the
XKeycodeToKeysym(display_, key_code, 0);
to
XkbKeycodeToKeysym(display_, key_code, 0, 0)
you should get rid of the errors.

NO WARRANTY
I did the above changes. No more warning for deprecated(at least until it gets passed the following maybe, lol). Sadly though now warnings for

Code: Select all

fatal error: X11/XKBlib.h: No such file or directory
9 | #Include <X11/XKBlib.h>
I don't feel entirely worthless at troubleshooting:

Code: Select all

sudo find / -name XKBlib.h
mkdir /home/.../2wm-0.1/X11 
sudo cp /usr/include/X11/XKBlib.h /home/me/otherfoldersblahblah..../X11/XKlib.h
I'm semi proud I was able to find it, I assumed copying it into the folder I'm making from might help make to find it, alas, I have no idea what I'm doing as usual :D

Anyways, since the general consensus seemed to be that "these warnings are not the warnings you should be looking out for" - Obi, I went ahead and dropped my paranoia and make installed:
Last edited by catfood on Thu Jul 23, 2020 6:13 pm, edited 1 time in total.
Thank You!
(I remember when debian "non-gui" installer scared me. #never-forget)

Post Reply