You are not logged in.

#1 2023-03-06 01:14:48

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

[SOLVED] Trying to get xbindkeys to autostart

I can't get xbindkeys to autostart upon startx.

I'm using xfce4 desktop environment and I don't use any display managers (I prefer not to), I start the DE with startx directly after logging in.

So far, I have attempted using ~/.xinitrc, and the Application Autostart tab from "Session and Startup" of xfce4.

Xinitrc works when I use it to run other commands.

Xbindkeys works when I enter 'xbindkeys' directly into a terminal after xfce starts.

What I tried:

~/.xinitrc
xbindkeys &
exec startxfce4
~/.xinitrc
xbindkeys
exec startxfce4
~/.xinitrc
( sleep 5 && xbindkeys ) &
exec startxfce4

my .xbindkeysrc file:
https://pastebin.com/L6XQNTnC

What should I do to get this thing to autostart, or is there a better way of binding a key to a command like I'm doing here?

I looked though some other people having trouble autostarting xbindkeys. Some people using display managers managed to solve their problem, but I couldn't find any examples with either xfce or not using a display manager.

Thank you!

Last edited by js8cr3fk9 (2023-03-09 23:12:51)

Offline

#2 2023-03-06 01:15:24

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

oops accidentally clicked submit before finishing formatting

Last edited by js8cr3fk9 (2023-03-07 22:29:14)

Offline

#3 2023-03-06 08:39:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: [SOLVED] Trying to get xbindkeys to autostart

What makes you believe that

~/.xinitrc
xbindkeys &
exec startxfce4

doesn't work?
Is there no xbindkeys process?

What if you

~/.xinitrc
xbindkeys > /tmp/xbindkeys.log 2>&1 &
exec startxfce4

Sidebar: if that's your entire xinitrc, it's broken - see the last link below and the note on what to include at least.

Offline

#4 2023-03-06 18:26:45

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

seth wrote:

What makes you believe that

~/.xinitrc
xbindkeys &
exec startxfce4

doesn't work?
Is there no xbindkeys process?

What if you

~/.xinitrc
xbindkeys > /tmp/xbindkeys.log 2>&1 &
exec startxfce4

Sidebar: if that's your entire xinitrc, it's broken - see the last link below and the note on what to include at least.

The entire xinitrc was just those 2 lines. I didn't read through the wiki page carefully and I just assumed it would work because I was just running startxfce4 directly before I started messing with xinitrc.

I changed the xinitrc file and here's what it looks like now.

After I changing the xinitrc file, I can now see an xbindkeys task in my task manager, but my bind keys still doesn't appear to do anything (my keys doesn't adjust volume and brightness when I press them). If I enter xbindkeys into a terminal, my bind keys starts working, and another xbindkeys task will pop up in task manager.

/tmp/xbindkeys.log is created but empty.

Last edited by js8cr3fk9 (2023-03-06 23:03:15)

Offline

#5 2023-03-06 20:55:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: [SOLVED] Trying to get xbindkeys to autostart

/tmp/xbindkeys.log is empty.

That's ok, there might just have been an error logged there.
Try

xbindkeys -n > /tmp/xbindkeys.log 2>&1 &

though, since xbindkeys in daemon mode will somewhat silently fail (if it does)

in my task manager

ps fux

Edit: also a secondary instance (xbindkeys -n) will warn you that there's an instance already running.

my keys doesn't adjust volume and brightness when I press them

Post your $HOME/.xbindkeysrc

Last edited by seth (2023-03-06 20:57:21)

Offline

#6 2023-03-06 22:27:53

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

seth wrote:

/tmp/xbindkeys.log is empty.

That's ok, there might just have been an error logged there.
Try

xbindkeys -n > /tmp/xbindkeys.log 2>&1 &

though, since xbindkeys in daemon mode will somewhat silently fail (if it does)

in my task manager

ps fux

Edit: also a secondary instance (xbindkeys -n) will warn you that there's an instance already running.

my keys doesn't adjust volume and brightness when I press them

Post your $HOME/.xbindkeysrc

/tmp/xbindkeys.log is still empty, and buttons not changing volume/brightness after autostart.

ps fux sample:

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
u4H          299  0.0  0.1   7876  4352 tty1     Ss   16:38   0:00 -bash
u4H          318  0.0  0.1   7612  4096 tty1     S+   16:38   0:00  \_ /bin/sh /usr/bin/startx
u4H          333  0.0  0.0   4008  2304 tty1     S+   16:38   0:00      \_ xinit /home/u4H/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.bZmUgBwzfL
u4H          334  5.4  2.2 755644 89096 tty1     Sl   16:38   0:09          \_ /usr/lib/Xorg -nolisten tcp :0 vt1 -keeptty -auth /tmp/serverauth.bZmUgBwzfL
u4H          343  0.1  1.6 610456 65660 tty1     Sl   16:38   0:00          \_ xfce4-session
u4H          347  0.0  0.2  24224  9728 tty1     Sl   16:38   0:00              \_ xbindkeys -n

.xbindkeysrc file pastebin

Last edited by js8cr3fk9 (2023-03-07 21:50:53)

Offline

#7 2023-03-06 23:20:18

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: [SOLVED] Trying to get xbindkeys to autostart

Please don't post (oversized) images of text, post the text.

Why is xbindkeys a child process of xfce4-session (w/ a higher PID)?
Replace "exec startxfce4" w/ "exec xfce4-session" in your xinitrc.

Offline

#8 2023-03-07 22:28:33

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

My bad about the image.

seth wrote:

child process of xfce4-session (w/ a higher PID)

Not sure what this means. If you're talking about it branching off xfce4-session in the COMMAND column, I think that's caused by the -n argument. Xbindkey's PID is higher both with and without -n though.

ps fux output with -n

# sample of file
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
u4H          333  0.0  0.0   4008  2304 tty1     S+   16:38   0:00      \_ xinit /home/u4H/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.bZmUgBwzfL
u4H          343  0.1  1.6 610456 65660 tty1     Sl   16:38   0:00          \_ xfce4-session
u4H          347  0.0  0.2  24224  9728 tty1     Sl   16:38   0:00              \_ xbindkeys -n

ps fux output without -n

# sample of file
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
u4H          330  0.0  0.0   4008  2304 tty1     S+   16:42   0:00      \_ xinit /home/u4H/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.smB0CROPoB/tmp/serverauth.smB0CROPoB
u4H          340  2.5  1.8 610444 72240 tty1     Sl   16:42   0:00          \_ xfce4-session
u4H          351  0.0  0.1  24224  4712 ?        S    16:42   0:00 xbindkeys

When I run "xbindkeys" with "exec xfce4-session", ps fux outputs 2 xbindkey processes, with one of them showing up as "[xbindkeys] <defunct>". Nothing else seems to happen though, I still need to manually launch xbindkeys to get my keys to work.

ps fux output with xbindkeys & exec xfce4-session

u4H          330  0.0  0.0   4008  2304 tty1     S+   16:53   0:00      \_ xinit /home/u4H/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.FaLbS6Du9O/tmp/serverauth.FaLbS6Du9O
u4H          340  0.3  1.8 610392 69968 tty1     Sl   16:53   0:00          \_ xfce4-session
u4H          344  0.0  0.0      0     0 tty1     Z    16:53   0:00              \_ [xbindkeys] <defunct>
u4H          347  0.0  0.1  24224  4720 ?        S    16:53   0:00 xbindkeys

/tmp/xbindkeys.log is empty in all the cases I mentioned.

Full ps fux outputs:
xbindkeys
xbindkeys -n
xbindkeys & xfce4-session
xbindkeys -n & xfce4-session

Last edited by js8cr3fk9 (2023-03-07 22:31:55)

Offline

#9 2023-03-08 07:13:37

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: [SOLVED] Trying to get xbindkeys to autostart

…
xbindkeys &
sleep 5
exec xfce4-session

Do you by any chance also run xbindkeys from https://wiki.archlinux.org/title/Xfce#Autostart ?

Offline

#10 2023-03-08 21:50:58

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

I just found out that "xbindkeys & startxfce4" kinda worked all along; however, I have to press something (any key) on my keyboard before xbindkeys launches, otherwise my xbindkeys keys won't work for the rest of the desktop session (without launching them again). I also tested this by creating a clickable launcher for xbindkeys to test it out, and it confirmed my guess.

Now I need to make it work without needing to manually press stuff. Maybe something has to be activated before xbindkey starts?

It doesn't seem to have anything to do with the commands in my .xbindkeysrc file. I changed my .xbindkeyscr file to the code below to test:

"ps fux > /home/u4H/Desktop/test"
  XF86AudioMute

and the same thing I described above still happened.

seth wrote:

Do you by any chance also run xbindkeys from https://wiki.archlinux.org/title/Xfce#Autostart ?

I tried that before and it didn't work out so I removed it from the autostart tab.

Last edited by js8cr3fk9 (2023-03-08 21:59:50)

Offline

#11 2023-03-08 22:01:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,627

Re: [SOLVED] Trying to get xbindkeys to autostart

Offline

#12 2023-03-08 22:17:21

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

I just found out that "xbindkeys & startxfce4" kinda worked all along; however, I have to press something (any key) on my keyboard before xbindkeys launches, otherwise my xbindkeys keys won't work for the rest of the desktop session (without launching them again). I also tested this by creating a clickable launcher for xbindkeys to test it out, and it confirmed my guess.

I just found out that the XF86 keys were causing this. I assigned a command to a normal key and it worked without a problem. Now I need to find out what's causing the problem with the XF86 keys.

seth wrote:

Xorg.0.log
Xorg.1.log

Last edited by js8cr3fk9 (2023-03-08 22:27:33)

Offline

#13 2023-03-09 23:08:39

js8cr3fk9
Member
Registered: 2023-03-06
Posts: 10

Re: [SOLVED] Trying to get xbindkeys to autostart

seth wrote:

Thanks for the help seth.

It turns out that I just have to include the key's state and keycode (m:0x8 + c:32) in .xbindkeysrc for it to work, like:

"pamixer --toggle-mute"
   m:0x0 + c:74
   XF86AudioMute

instead of:

"pamixer --toggle-mute"
   XF86AudioMute

Last edited by js8cr3fk9 (2023-03-10 03:21:59)

Offline

Board footer

Powered by FluxBB