dotfiles/gui/awesome/autostart
2022-09-08 21:52:08 +08:00

40 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# startup apps
! /bin/pgrep nextcloud && nextcloud &
! /bin/pgrep flameshot && flameshot &
! /bin/pgrep nm-applet && nm-applet &
! /bin/pgrep copyq && copyq &
! /bin/pgrep syncthing && syncthing &
# ! /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%
DOW=$(date +%u)
HOD=$(date +%k)
[ "$DOW" -ge 1 ] && [ "$DOW" -le 5 ] \
&& [ "$HOD" -ge 8 ] && [ "$HOD" -le 20 ] \
&& gpg -d "$(ls ~/.password-store/*.gpg | head -n 1)" > /dev/null