From 85a1c3b46937d2ed566b1530d635e2e539c7c3c1 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Tue, 27 Aug 2024 21:42:29 +0200 Subject: [PATCH] chore: moved hotkey daemon to it's own script and run with a terminal to allow prompting authentication --- bin/actions/hotkey-daemon.sh | 17 +++++++++++++++++ bin/actions/startup.sh | 5 ++++- bin/dotf | 2 +- config/config.yaml | 10 ++++------ vscode/argv.json | 2 +- 5 files changed, 27 insertions(+), 9 deletions(-) create mode 100755 bin/actions/hotkey-daemon.sh diff --git a/bin/actions/hotkey-daemon.sh b/bin/actions/hotkey-daemon.sh new file mode 100755 index 0000000..dc3cbf2 --- /dev/null +++ b/bin/actions/hotkey-daemon.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env zsh + +source $HOME/dotfiles/bin/helpers/functions.sh + +# Kill any running swhkd and swhks processes +if pgrep -x "swhkd" > /dev/null; then + printfe "%s\n" "yellow" "swhkd is running, killing it..." + sudo pkill swhkd +fi + +if pgrep -x "swhks" > /dev/null; then + printfe "%s\n" "yellow" "swhks is running, killing it..." + sudo pkill swhks +fi + +printfe "%s\n" "green" "Starting hotkey daemon..." +swhks & pkexec swhkd -c ~/.config/swhkdrc diff --git a/bin/actions/startup.sh b/bin/actions/startup.sh index f92a943..64d36d0 100755 --- a/bin/actions/startup.sh +++ b/bin/actions/startup.sh @@ -18,15 +18,18 @@ run_startup_scripts() { case $(date +%H) in 0[0-9]|1[0-1]) time_of_day="morning" + emoji="🌅" ;; 1[2-7]) time_of_day="afternoon" + emoji="🌞" ;; 1[8-9]|2[0-3]) time_of_day="evening" + emoji="🌆" ;; esac - printfe "%s" "cyan" "Welcome and good $time_of_day $(whoami)!" + printfe "%s" "cyan" "Hi $(whoami), good $time_of_day! $emoji" echo "" # Initialize array to hold commands diff --git a/bin/dotf b/bin/dotf index 533dce5..8aaf03e 100755 --- a/bin/dotf +++ b/bin/dotf @@ -79,7 +79,7 @@ case $1 in $HOME/dotfiles/bin/actions/term.sh $@ ;; "hotkey-daemon") - bash -c "swhks & pkexec swhkd -c ~/.config/swhkdrc" & + x-terminal-emulator -e $HOME/dotfiles/bin/actions/hotkey-daemon.sh $@ ;; *) printfe "%s\n" "red" "Unknown command $1" diff --git a/config/config.yaml b/config/config.yaml index cb4d0d5..84b747f 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -79,18 +79,16 @@ config: # Commands to run after login startup: - delay: 1 - delay_between_ms: 500 + delay: 5 + delay_between_ms: 1 commands: 1password: 1password hotkey-deamon: dotf hotkey-daemon - # Might want to run steam in flatpak at some point: flatpak run com.valvesoftware.Steam - # Not possible at this point due to avorion needing workshop mods symlinked - steam: steam trayscale: flatpak run dev.deedles.Trayscale - spotify: flatpak run com.spotify.Client vesktop: flatpak run dev.vencord.Vesktop telegram: flatpak run org.telegram.desktop + spotify: flatpak run com.spotify.Client + steam: steam # Fonts to install (Mostly tested with Nerd Fonts) fonts: diff --git a/vscode/argv.json b/vscode/argv.json index eea6f2d..1013ec4 100644 --- a/vscode/argv.json +++ b/vscode/argv.json @@ -1,3 +1,3 @@ { - "enable-crash-reporter": false, + "enable-crash-reporter": true, }