refactor: extract autostart to a independent script

This commit is contained in:
Klesh Wong 2022-07-30 10:15:33 +08:00
parent 1e9ce5a365
commit 5f3e3c1456
3 changed files with 32 additions and 14 deletions

View File

@ -66,5 +66,6 @@ EOT
# configuration
lnsf "$DIR/awesome/rc.lua" "$XDG_CONFIG_HOME/awesome/rc.lua"
lnsf "$DIR/awesome/autostart" "$XDG_CONFIG_HOME/awesome/autostart"
lnsf "$DIR/rofi/config.rasi" "$XDG_CONFIG_HOME/rofi/config.rasi"
lnsf "$DIR/rofi/catppuccin.rasi" "$XDG_CONFIG_HOME/rofi/catppuccin.rasi"

30
gui/awesome/autostart Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# startup apps
! /bin/pgrep nextcloud && nextcloud &
! /bin/pgrep flameshot && flameshot &
! /bin/pgrep nm-applet && nm-applet &
! /bin/pgrep copyq && copyq &
! /bin/pgrep -f "lua virtcam.lua" && cd ~/dotfiles/gui/virtcam && lua virtcam.lua &
# input method
ibus-daemon -drx
# turn bluetooth power on
bluetoothctl power on
# export X variable for cronjob to send notification
echo DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS > ~/.cron.env
echo DISPLAY=$DISPLAY >> ~/.cron.env
# adjust brightness in battery mode
grep -F 0 /sys/class/power_supply/ACAD/online && sudo light -S 30
# prioritize hdmi output
HDMI_SINK=$(pactl list short sinks | awk '{print $2}' | grep hdmi)
if [ -n "$HDMI_SINK" ]; then
pactl set-default-sink "$HDMI_SINK"
fi
# fix pulseaudio echo-cancel side effect
pactl set-source-volume @DEFAULT_SOURCE@ 100%

View File

@ -872,17 +872,4 @@ client.connect_signal("unfocus", function(c)
--c.border_width = 0
end)
-- Autostart
awful.spawn.with_shell("! /bin/pgrep nextcloud && nextcloud")
awful.spawn.with_shell("ibus-daemon -drx")
awful.spawn.with_shell("flameshot")
--awful.spawn.with_shell("blueman-applet")
awful.spawn.with_shell("nm-applet")
awful.spawn.with_shell("copyq")
awful.spawn.with_shell("bluetoothctl power on")
-- store session variables for crontab
awful.spawn.with_shell("echo DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS > ~/.cron.env")
awful.spawn.with_shell("echo DISPLAY=$DISPLAY >> ~/.cron.env")
awful.spawn.with_shell("grep -F 0 /sys/class/power_supply/ACAD/online && sudo light -S 30")
awful.spawn.with_shell("cd ~/dotfiles/gui/virtcam && lua virtcam.lua")
-- }}}
awful.spawn.with_shell("~/.config/awesome/autostart")