Manage autostart programs in xmonad

I start programs on xsession enter via ~/.xsessionrc.

To make programs get started on the specified workspaces I use
xmonad's manageHook with `className =?' functionality to match
programs to spawn.
This commit is contained in:
c47 2024-01-14 11:18:24 +01:00
parent 75d9206a6f
commit d3b47ba8d4
3 changed files with 28 additions and 9 deletions

View file

@ -8,7 +8,7 @@ CONFIG_DIR=${XDG_CONFIG_HOME:-${HOME}/.config}
cd
# bash
# Bash
for config in ${WORKING_DIR}/bash/*; do
file=$(basename ${config})
@ -19,11 +19,19 @@ for config in ${WORKING_DIR}/bash/*; do
done
# Neovim
if [[ ! -L ${CONFIG_DIR}/nvim ]]; then
ln -s ${WORKING_DIR}/nvim/ ${CONFIG_DIR}/nvim 2>/dev/null
fi
# Tmux
if [[ ! -L ${HOME}/.tmux.conf ]]; then
ln -s ${WORKING_DIR}/tmux/tmux.conf .tmux.conf 2>/dev/null
fi
# XsessionRC
if [[ ! -L ${HOME}/.xsessionrc ]]; then
ln -s ${WORKING_DIR}/xsessionrc .xsessionrc 2>/dev/null
fi

View file

@ -1,18 +1,27 @@
import XMonad
import XMonad.Util.Ungrab
import XMonad.Util.EZConfig -- for the keybindings
import XMonad.Actions.SpawnOn -- Spawn programs on specified workspace
import XMonad.Util.EZConfig -- For the keybindings
import XMonad.Util.SpawnOnce -- For the startupHook
import XMonad.Actions.SpawnOn -- Spawn programs on specified workspace
import XMonad.Hooks.ManageDocks -- For the manageHook
myTerminal = "gnome-terminal"
myModMask = mod4Mask
myTerminal = "terminator"
myModMask = mod4Mask
myManageHook = composeAll . concat $
[ [ className =? "DailyFox" --> doShift "1" ]
, [ className =? "DailyShell" --> doShift "2" ]
, [ manageDocks ]
]
main = do
xmonad $ def
xmonad $ def
{
terminal = myTerminal
, modMask = myModMask
terminal = myTerminal
, modMask = myModMask
, manageHook = myManageHook <+> manageHook def
}
`additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_l), spawn "slock")
, ((mod4Mask .|. shiftMask, xK_f), spawn "firefox --class='DailyFox' -P 'default-esr'")
]

2
xsessionrc Normal file
View file

@ -0,0 +1,2 @@
/usr/bin/firefox --class="DailyFox" -P "default-esr" &
/usr/bin/terminator --name="DailyShell" -e "bash /home/c47/.local/scripts/default-tmux.sh -" &