dotfiles/.xsessionrc

149 lines
3.8 KiB
Plaintext
Raw Permalink Normal View History

2020-07-31 07:08:07 +00:00
#!/usr/bin/env bash
2020-06-16 01:16:16 +00:00
2023-07-19 19:33:36 +00:00
if test -f ${HOME}/.xsessionrc-local ; then
${HOME}/.xsessionrc-local
fi
2023-09-20 21:30:16 +00:00
function set_backgrounds() {
2024-05-17 21:35:12 +00:00
if test -f /usr/share/backgrounds/my/outrun-vaporwave.jpg; then
feh --bg-fill /usr/share/backgrounds/my/outrun-vaporwave.jpg &
elif test -f /usr/share/backgrounds/ubuntu2_by_arman1992.jpg; then
2023-09-20 21:30:16 +00:00
feh --bg-fill /usr/share/backgrounds/ubuntu2_by_arman1992.jpg &
elif test -f /usr/share/backgrounds/Mirror_by_Uday_Nakade.jpg; then
feh --bg-fill /usr/share/backgrounds/Mirror_by_Uday_Nakade.jpg &
elif test -f /usr/share/backgrounds/brad-huchteman-stone-mountain.jpg ; then
feh --bg-fill /usr/share/backgrounds/brad-huchteman-stone-mountain.jpg &
elif test -f /usr/share/backgrounds/gnome/Road.jpg ; then
feh --bg-fill /usr/share/backgrounds/gnome/Road.jpg &
elif test -f /usr/share/backgrounds/gnome/blobs-l.svg ; then
feh --bg-fill /usr/share/backgrounds/gnome/blobs-l.svg &
fi
2023-09-20 21:30:16 +00:00
}
2020-06-16 01:16:16 +00:00
2023-09-20 21:30:16 +00:00
function start_desktop_applications() {
# Barrier - Keyboard and mouse sharing tool
if command -v barrier &> /dev/null ; then
barrier &
2021-10-20 20:21:36 +00:00
fi
2023-09-20 21:30:16 +00:00
# Deja duplicty backup monitor
if test /usr/libexec/deja-dup/deja-dup-monitor ; then
/usr/libexec/deja-dup/deja-dup-monitor &
elif test /usr/lib/deja-dup/deja-dup-monitor ; then
/usr/lib/deja-dup/deja-dup-monitor &
2021-10-20 20:21:36 +00:00
fi
2023-09-20 21:30:16 +00:00
# Nextcloud files synchronization
2021-10-20 20:21:36 +00:00
if command -v nextcloud &> /dev/null ; then
2021-11-22 19:02:19 +00:00
nextcloud --background &
2021-10-20 20:21:36 +00:00
fi
2023-09-20 21:30:16 +00:00
2023-09-20 21:41:30 +00:00
# Thunderbird email client
if command -v thunderbird &> /dev/null ; then
thunderbird &
fi
2023-09-20 21:30:16 +00:00
# Blue light filter app
if command -v redshift &> /dev/null ; then
redshift -c ${HOME}/.config/redshift.conf &
fi
# Signal messaging
2021-10-20 20:21:36 +00:00
if command -v signal-desktop &> /dev/null ; then
signal-desktop --start-in-tray &
fi
2023-09-20 21:30:16 +00:00
# Steam game launcher
2021-11-22 19:01:21 +00:00
if command -v steam &> /dev/null ; then
steam -silent &
fi
2023-09-20 21:30:16 +00:00
# Timekpr client applications
if command -v timekprc &> /dev/null ; then
timekprc &
fi
}
function start_desktop_helper_apps() {
2023-10-24 16:23:30 +00:00
# set keyboard layout
setxkbmap -layout pl
2023-09-20 21:30:16 +00:00
# Notification handler
dunst &
# Picom compositor
picom -b
# Setting numlock on
numlockx on &
# App to watch battery level
battery-watch &
2023-11-21 21:07:03 +00:00
# Set display layouts
autorandr -c
2023-09-20 21:30:16 +00:00
}
function start_applets() {
# Audio
if command -v pasystray &> /dev/null ; then
pasystray &
fi
# Bluetooth
if command -v blueman-applet &> /dev/null ; then
blueman-applet &
fi
# Network manager
if command -v nm-applet &> /dev/null ; then
nm-applet &
2021-10-20 20:21:36 +00:00
fi
2023-09-20 21:30:16 +00:00
}
2021-10-20 20:21:36 +00:00
2023-09-20 21:30:16 +00:00
# Authentication agent for running application as root
function start_polkit() {
# Archlinux
if test /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 ; then
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
fi
# Ubuntu
2021-10-20 20:21:36 +00:00
if test /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 ; then
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &
fi
2023-09-20 21:30:16 +00:00
}
2021-10-20 20:21:36 +00:00
2023-09-20 21:30:16 +00:00
function start_lockscreen_handler() {
if command -v xss-lock - &> /dev/null ; then
/usr/bin/xss-lock -- i3lock -f -t -c 000000 -n &
else
notify-send -u CRITICAL "Missing xss-lock cannot lock screen"
2022-04-02 11:24:30 +00:00
fi
2023-09-20 21:30:16 +00:00
}
2023-07-10 20:13:26 +00:00
2023-09-20 21:30:16 +00:00
if [[ "$DESKTOP_SESSION" = "dwm" || "$DESKTOP_SESSION" == "dwm-gnome" ]]; then
export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit
wmname LG3D
start_desktop_helper_apps
2023-09-27 00:45:15 +00:00
start_lockscreen_handler
2023-09-20 21:30:16 +00:00
start_applets
start_polkit
start_desktop_applications
2023-09-22 21:40:40 +00:00
set_backgrounds
2023-09-20 21:30:16 +00:00
fi
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
# shellcheck source=/dev/null
[ -x "$f" ] && . "$f"
done
unset f
2020-07-30 07:54:52 +00:00
fi
2023-09-20 21:30:16 +00:00
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap