From 016875f7d42695f589503f3de67ce964c3bb6f5b Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Mon, 3 Mar 2025 23:39:21 +0100 Subject: [PATCH] hypr: make startup script more robust --- .../hypr/scripts/gammarelay-auto-temp.py | 2 +- dot-config/hypr/scripts/keepassxc.sh | 19 +++++++++++++++++++ dot-config/hypr/scripts/startup.sh | 14 ++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100755 dot-config/hypr/scripts/keepassxc.sh diff --git a/dot-config/hypr/scripts/gammarelay-auto-temp.py b/dot-config/hypr/scripts/gammarelay-auto-temp.py index 9fac7e38..72b93a3f 100755 --- a/dot-config/hypr/scripts/gammarelay-auto-temp.py +++ b/dot-config/hypr/scripts/gammarelay-auto-temp.py @@ -10,7 +10,7 @@ def mk_time(hours, minutes, seconds=0): return hours * 3600.0 + minutes * 60.0 + seconds TEMP_DAY = 6500.0 -TEMP_NIGHT = 3800.0 +TEMP_NIGHT = 4200.0 DAWN_TIME = mk_time( 7, 48) # 9:00 (Should be > WINDOW) DUSK_TIME = mk_time(16, 45) # 19:00 (Shoulbe be > WINDOW + DAWN_TIME) diff --git a/dot-config/hypr/scripts/keepassxc.sh b/dot-config/hypr/scripts/keepassxc.sh new file mode 100755 index 00000000..034b2e6e --- /dev/null +++ b/dot-config/hypr/scripts/keepassxc.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# See https://github.com/nextcloud/desktop/issues/1011 +# +############################################ +# Adjust the following to suit your needs +MAX_TRIES=3 # Max. number of tries to ask for password +############################################ +i=0 +while [ $i -lt $MAX_TRIES ]; do + ((i++)) + open="$(qdbus6 org.kde.kwalletd6 /modules/kwalletd6 isOpen kdewallet)" + if [ "$open" = "true" ]; then + break + fi + qdbus6 org.kde.kwalletd6 /modules/kwalletd6 open kdewallet 0 "nextcloud-client-starter" > /dev/null +done +exec nextcloud --background + diff --git a/dot-config/hypr/scripts/startup.sh b/dot-config/hypr/scripts/startup.sh index 40dfdeed..ff1e97ab 100755 --- a/dot-config/hypr/scripts/startup.sh +++ b/dot-config/hypr/scripts/startup.sh @@ -1,14 +1,15 @@ #!/usr/bin/env bash +# shellcheck disable=SC2015 logger '============================' logger 'HYPRLAND MAIN STARTUP BEGIN' -# shellcheck disable=SC2155 -# shellcheck disable=SC2046 + +# shellcheck disable=SC2155,SC2046 test ! -d "$XDG_RUNTIME_DIR" && export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) && logger 'xdg-runtime dir set NOW' test ! "$DBUS_SESSION_BUS_ADDRESS" && dbus-daemon --session --address=unix:path="$XDG_RUNTIME_DIR"/bus && logger 'dbus session daemon started' dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP -export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:$HOME/Applications:$PATH" +# export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:$HOME/Applications:$PATH" #------------------------------------------------------ xdg-desktop-portal killall -e xdg-desktop-portal-hyprland @@ -27,7 +28,7 @@ sleep 2 test -f /usr/libexec/xdg-desktop-portal && /usr/libexec/xdg-desktop-portal & #------------------------------------------------------ polkit-kde -if [[ ! $(pidof /usr/libexec/polkit-kde-authentication-agent-1) ]]; then +if ! pidof /usr/libexec/polkit-kde-authentication-agent-1; then if ! command -v /usr/libexec/polkit-kde-authentication-agent-1 &> /dev/null then echo "polkit-kde not installed" @@ -60,9 +61,10 @@ pidof swaync && pkill swaync || swaync > /dev/null 2>&1 & pidof openrgb && pkill openrgb || openrgb -p default --startminimized & pidof udiskie && pkill udiskie || udiskie --no-automount --no-notify --tray & pidof corectrl && pkill corectrl || corectrl --minimize-systray > /dev/null 2>&1 & -! pidof keepassxc && keepassxc > /dev/null 2>&1 & -# ! pidof kwalletmanager5 && /usr/libexec/pam_kwallet_init & +if pidof kwalletd6; then + ~/.config/hypr/scripts/keepassxc.sh +fi ! pidof swww-daemon && nohup /usr/bin/swww-daemon > /dev/null 2>&1 sleep 0.5 && ~/.local/bin/rndwallpaper swww -- 2.51.2