You are not logged in.

#1 2015-11-25 01:30:32

EmmAG
Member
From: United States
Registered: 2015-11-25
Posts: 8

Xbindkeys works when manually activated but not automatic from startup

Hi,
I'm using Arch with openbox as a standalone DE and am trying to get Xbindkeys to be started with X on booting. I added

xbindkeys

directly above

exec openbox-session

in

~/.xinitrc

as the wiki suggested.

The only way I can actually get xbindkeys working though is by starting it from terminal after logging in.

Offline

#2 2015-11-25 01:33:57

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Xbindkeys works when manually activated but not automatic from startup

Does it work using the Openbox autostart file: https://wiki.archlinux.org/index.php/Openbox#autostart


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-11-25 01:35:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,541
Website

Re: Xbindkeys works when manually activated but not automatic from startup

Can you post your full ~/.xinitrc?

How do you start X (with startx, xinit, or a display manager)?

Can you put some other command right before the exec line, like a terminal emulator to see if it starts?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2015-11-26 20:50:43

EmmAG
Member
From: United States
Registered: 2015-11-25
Posts: 8

Re: Xbindkeys works when manually activated but not automatic from startup

jasonwryan wrote:

Does it work using the Openbox autostart file: https://wiki.archlinux.org/index.php/Openbox#autostart

No, unfortunately, that doesn't work either



Trilby wrote:

Can you post your full ~/.xinitrc?

How do you start X (with startx, xinit, or a display manager)?

Can you put some other command right before the exec line, like a terminal emulator to see if it starts?

Sure, I currently start X with LightDM 

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

# twm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &
# exec xterm -geometry 80x66+0+0 -name login

exec urxvt xbindkeys
exec openbox-session

Offline

#5 2015-11-26 21:13:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Xbindkeys works when manually activated but not automatic from startup

Only one exec line is read in .xinitrc and you don't launch xbindkeys with urxvt, AFAIAA...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2015-11-26 22:04:59

fmscott1
Member
Registered: 2012-03-10
Posts: 6

Re: Xbindkeys works when manually activated but not automatic from startup

xbindkeys &  or

# Autostart xbindkeys
(sleep 10s && xbindkeys) &

Last edited by fmscott1 (2015-11-26 22:10:22)

Offline

#7 2015-11-26 22:53:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,541
Website

Re: Xbindkeys works when manually activated but not automatic from startup

LightDM doesn't use xinitrc, so you could put whatever you want in there - it will not be used.

LightDM uses xprofile.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2015-11-28 02:19:51

EmmAG
Member
From: United States
Registered: 2015-11-25
Posts: 8

Re: Xbindkeys works when manually activated but not automatic from startup

Trilby wrote:

LightDM doesn't use xinitrc, so you could put whatever you want in there - it will not be used.

LightDM uses xprofile.

This did it! I also used the correct command provided by fmscott1, to get the xprofile file working. Here's my /etc/lightdm/Xsession for anyone in a very similar situation:

#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        . "$file"
    fi
done

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
    if [ -f "$file" ]; then
        echo "Loading resource: $file"
        xrdb -merge "$file"
    fi
done

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
    if [ -f "$file" ]; then
        echo "Loading keymap: $file"
        setxkbmap `cat "$file"`
        XKB_IN_USE=yes
    fi
done

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
        if [ -f "$file" ]; then
           echo "Loading modmap: $file"
           xmodmap "$file"
        fi
    done
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
    for script in $xinitdir/*; do
        echo "Loading xinit script $script"
        if [ -x "$script" -a ! -d "$script" ]; then
            . "$script"
        fi
    done
fi

# Run user xsession shell script
script="$HOME/.xsession"
if [ -x "$script" -a ! -d "$script" ]; then
    echo "Loading xsession script $script"
    . "$script"
fi

echo "X session wrapper complete, running session $@"

exec xbindkeys & or 
# autostart xbindkeys
(sleep 10s && xbindkeys) &
$@

Thank you all for your help!

Offline

#9 2015-11-28 04:31:59

fmscott1
Member
Registered: 2012-03-10
Posts: 6

Re: Xbindkeys works when manually activated but not automatic from startup

EmmAG wrote:
Trilby wrote:

LightDM doesn't use xinitrc, so you could put whatever you want in there - it will not be used.

LightDM uses xprofile.

This did it! I also used the correct command provided by fmscott1, to get the xprofile file working. Here's my /etc/lightdm/Xsession for anyone in a very similar situation:

#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        . "$file"
    fi
done

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
    if [ -f "$file" ]; then
        echo "Loading resource: $file"
        xrdb -merge "$file"
    fi
done

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
    if [ -f "$file" ]; then
        echo "Loading keymap: $file"
        setxkbmap `cat "$file"`
        XKB_IN_USE=yes
    fi
done

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
        if [ -f "$file" ]; then
           echo "Loading modmap: $file"
           xmodmap "$file"
        fi
    done
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
    for script in $xinitdir/*; do
        echo "Loading xinit script $script"
        if [ -x "$script" -a ! -d "$script" ]; then
            . "$script"
        fi
    done
fi

# Run user xsession shell script
script="$HOME/.xsession"
if [ -x "$script" -a ! -d "$script" ]; then
    echo "Loading xsession script $script"
    . "$script"
fi

echo "X session wrapper complete, running session $@"

exec xbindkeys & or 
# autostart xbindkeys
(sleep 10s && xbindkeys) &
$@

Thank you all for your help!

exec xbindkeys &   is all you  need.  The  other option  would  work if  you  needed that  program  to wait  before  starting. You can  delete  or  comment that  out.

Offline

Board footer

Powered by FluxBB