basilisk but actually + cleanup
This commit is contained in:
163
home/.basilisk/bin/bas
Executable file
163
home/.basilisk/bin/bas
Executable file
@@ -0,0 +1,163 @@
|
||||
#!/bin/sh
|
||||
export SCHEME="$(xrescat basilisk.theme)"
|
||||
export BAS_ROOT="$(dirname "$(realpath "$0")")/../"
|
||||
restart_panel() {
|
||||
pkill waybar
|
||||
shchemes inject "${BAS_ROOT}/waybar/style.css"
|
||||
waybar \
|
||||
-c "${BAS_ROOT}/waybar/config.jsonc" \
|
||||
-s "${BAS_ROOT}/waybar/style.css" & disown
|
||||
|
||||
}
|
||||
notifs() {
|
||||
rofication-gui
|
||||
|
||||
}
|
||||
power-off-monitors() {
|
||||
niri msg action power-off-monitors
|
||||
|
||||
}
|
||||
lock() {
|
||||
img="/tmp/basilisk-lock.png"
|
||||
niri msg action screenshot-screen -p false -d true --path "/tmp/basilisk-lock-raw.png"
|
||||
inotifywait -q -e close_write /tmp/basilisk-lock-raw.png | head -n1
|
||||
magick "/tmp/basilisk-lock-raw.png" \
|
||||
-set colorspace Gray \
|
||||
"$img"
|
||||
swaylock -i "$img" & disown
|
||||
|
||||
}
|
||||
suspend() {
|
||||
systemctl suspend && lock
|
||||
|
||||
}
|
||||
logout() {
|
||||
loginctl terminate-session ${XDG_SESSION_ID-}
|
||||
|
||||
}
|
||||
shutdown() {
|
||||
systemctl poweroff
|
||||
|
||||
}
|
||||
reboot() {
|
||||
systemctl reboot
|
||||
|
||||
}
|
||||
reload_compositor() {
|
||||
shchemes inject "${BAS_ROOT}/niri/config.kdl"
|
||||
|
||||
}
|
||||
reload_shell() {
|
||||
"${BAS_ROOT}/genctl"
|
||||
|
||||
}
|
||||
timeout_daemon() {
|
||||
pkill swayidle
|
||||
swayidle -w \
|
||||
timeout 300 'bas lock' \
|
||||
timeout 360 'bas power-off-monitors' \
|
||||
before-sleep 'bas power-off-monitors && bas lock' & disown
|
||||
|
||||
}
|
||||
notif_daemon() {
|
||||
pkill -f rofication-daemon
|
||||
rofication-daemon & disown
|
||||
|
||||
}
|
||||
wallpaper() {
|
||||
pkill swaybg
|
||||
swaybg -i "$(xrescat basilisk.wallpaper)"
|
||||
|
||||
}
|
||||
theme_apps() {
|
||||
shchemes inject "$HOME/.config/qutebrowser/config.py"
|
||||
shchemes create_theme css > "$HOME/.config/base16.css"
|
||||
shchemes create_theme css > "$HOME/.config/qutebrowser/base16.css"
|
||||
pkill -HUP qutebrowser
|
||||
shchemes create_theme rofi > "$HOME/.config/rofi/theme.rasi"
|
||||
|
||||
|
||||
}
|
||||
load() {
|
||||
reload_shell
|
||||
"$0" reload_compositor
|
||||
"$0" restart_panel
|
||||
"$0" notif_daemon
|
||||
"$0" timeout_daemon
|
||||
"$0" wallpaper
|
||||
"$0" theme_apps
|
||||
|
||||
}
|
||||
rofi_report() {
|
||||
[ -n "$BASILISK_ROFI_REPORT_STATE" ] && printf %s\n >> "$BASILISK_ROFI_REPORT_STATE"
|
||||
rofi -dmenu -format i -matching prefix -auto-select -markup -theme-str '
|
||||
element { font: "Noto Mono 11"; }
|
||||
' $BASILISK_ROFI_ARGS
|
||||
[ -n "$BASILISK_ROFI_REPORT_STATE" ] && printf %s\n >> "$BASILISK_ROFI_REPORT_STATE"
|
||||
}
|
||||
if [ -z "$1" ]; then
|
||||
case "$(printf %s\\n ' rb. Restart Panel
|
||||
n. Notifications
|
||||
pm. Power Off Monitors
|
||||
l. Lock
|
||||
ps. Suspend
|
||||
pe. Log Out
|
||||
pdy. Shutdown
|
||||
pry. Reboot
|
||||
rc. Reload Compositor
|
||||
rs. Reload Shell
|
||||
rdt. Reload Timeout Daemon
|
||||
rdn. Reload Notification Daemon
|
||||
rw. Reload Wallpaper
|
||||
rat. Reload App Themes
|
||||
rr. Reload All'| rofi_report)" in
|
||||
0) restart_panel ;;
|
||||
1) notifs ;;
|
||||
2) power-off-monitors ;;
|
||||
3) lock ;;
|
||||
4) suspend ;;
|
||||
5) logout ;;
|
||||
6) shutdown ;;
|
||||
7) reboot ;;
|
||||
8) reload_compositor ;;
|
||||
9) reload_shell ;;
|
||||
10) timeout_daemon ;;
|
||||
11) notif_daemon ;;
|
||||
12) wallpaper ;;
|
||||
13) theme_apps ;;
|
||||
14) load ;;
|
||||
esac
|
||||
else
|
||||
case "$1" in
|
||||
"restart_panel") restart_panel ;;
|
||||
"notifs") notifs ;;
|
||||
"power-off-monitors") power-off-monitors ;;
|
||||
"lock") lock ;;
|
||||
"suspend") suspend ;;
|
||||
"logout") logout ;;
|
||||
"shutdown") shutdown ;;
|
||||
"reboot") reboot ;;
|
||||
"reload_compositor") reload_compositor ;;
|
||||
"reload_shell") reload_shell ;;
|
||||
"timeout_daemon") timeout_daemon ;;
|
||||
"notif_daemon") notif_daemon ;;
|
||||
"wallpaper") wallpaper ;;
|
||||
"theme_apps") theme_apps ;;
|
||||
"load") load ;;
|
||||
"rb") restart_panel ;;
|
||||
"n") notifs ;;
|
||||
"pm") power-off-monitors ;;
|
||||
"l") lock ;;
|
||||
"ps") suspend ;;
|
||||
"pe") logout ;;
|
||||
"pdy") shutdown ;;
|
||||
"pry") reboot ;;
|
||||
"rc") reload_compositor ;;
|
||||
"rs") reload_shell ;;
|
||||
"rdt") timeout_daemon ;;
|
||||
"rdn") notif_daemon ;;
|
||||
"rw") wallpaper ;;
|
||||
"rat") theme_apps ;;
|
||||
"rr") load ;;
|
||||
esac
|
||||
fi
|
||||
Reference in New Issue
Block a user