diff --git a/.scripts/rofi-cliphist b/.scripts/rofi-cliphist new file mode 100755 index 0000000..8c349e6 --- /dev/null +++ b/.scripts/rofi-cliphist @@ -0,0 +1,5 @@ +#!/bin/sh + + +cliphist list | rofi -dmenu -config ~/.config/rofi/dmenu.rasi -display-columns 2 -i | \ + cliphist decode | wl-copy \ No newline at end of file diff --git a/niri/config.kdl b/niri/config.kdl index 6c5b185..c4ced67 100644 --- a/niri/config.kdl +++ b/niri/config.kdl @@ -273,7 +273,7 @@ binds { Mod+E { spawn "dolphin"; } Mod+W { spawn "zen"; } Mod+X { spawn "gnome-text-editor" "--new-window"; } - Mod+B { spawn-sh "killall btop || ghostty -e btop"; } + Mod+B { spawn-sh "pkill -x -n btop || ghostty -e btop"; } Mod+T { spawn "kitty"; } Mod+Return { spawn "kitty"; } Mod+Shift+T { spawn "ghostty"; } @@ -285,17 +285,17 @@ binds { Mod+Shift+L { spawn-sh "qs ipc call lyrics toggleBarLyrics"; } // Quickshell - Mod+Shift+K { spawn-sh "pkill quickshell || quickshell"; } + Mod+Shift+K { spawn-sh "pkill -x quickshell || quickshell"; } Mod+I { spawn-sh "qs ipc call idleInhibitor toggleInhibitor"; } // Rofi - Mod+D { spawn-sh "pkill rofi || rofi -show run"; } - Alt+Space { spawn-sh "pkill rofi || rofi -show drun"; } + Mod+D { spawn-sh "pkill -x rofi || rofi -show run"; } + Alt+Space { spawn-sh "pkill -x rofi || rofi -show drun"; } // Actions - Mod+V { spawn-sh "pkill rofi || cliphist list | rofi -dmenu -config ~/.config/rofi/dmenu.rasi -display-columns 2 -i | cliphist decode | wl-copy"; } - Mod+Period { spawn-sh "pkill rofi || rofi-emoji"; } - Ctrl+Alt+Delete { spawn-sh "pkill wlogout || wlogout -p layer-shell"; } + Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; } + Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; } + Ctrl+Alt+Delete { spawn-sh "pkill -x wlogout || wlogout -p layer-shell"; } Print { spawn-sh "screenshot full"; } Mod+Shift+S { spawn-sh "screenshot area"; } Mod+Ctrl+Shift+S { spawn-sh "screenshot window"; } diff --git a/niri/config.kdl.template b/niri/config.kdl.template index 3b6b24c..e4d11d2 100644 --- a/niri/config.kdl.template +++ b/niri/config.kdl.template @@ -273,7 +273,7 @@ binds { Mod+E { spawn "dolphin"; } Mod+W { spawn "zen"; } Mod+X { spawn "gnome-text-editor" "--new-window"; } - Mod+B { spawn-sh "killall btop || ghostty -e btop"; } + Mod+B { spawn-sh "pkill -x -n btop || ghostty -e btop"; } Mod+T { spawn "kitty"; } Mod+Return { spawn "kitty"; } Mod+Shift+T { spawn "ghostty"; } @@ -285,17 +285,17 @@ binds { Mod+Shift+L { spawn-sh "qs ipc call lyrics toggleBarLyrics"; } // Quickshell - Mod+Shift+K { spawn-sh "pkill quickshell || quickshell"; } + Mod+Shift+K { spawn-sh "pkill -x quickshell || quickshell"; } Mod+I { spawn-sh "qs ipc call idleInhibitor toggleInhibitor"; } // Rofi - Mod+D { spawn-sh "pkill rofi || rofi -show run"; } - Alt+Space { spawn-sh "pkill rofi || rofi -show drun"; } + Mod+D { spawn-sh "pkill -x rofi || rofi -show run"; } + Alt+Space { spawn-sh "pkill -x rofi || rofi -show drun"; } // Actions - Mod+V { spawn-sh "pkill rofi || cliphist list | rofi -dmenu -config ~/.config/rofi/dmenu.rasi -display-columns 2 -i | cliphist decode | wl-copy"; } - Mod+Period { spawn-sh "pkill rofi || rofi-emoji"; } - Ctrl+Alt+Delete { spawn-sh "pkill wlogout || wlogout -p layer-shell"; } + Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; } + Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; } + Ctrl+Alt+Delete { spawn-sh "pkill -x wlogout || wlogout -p layer-shell"; } Print { spawn-sh "screenshot full"; } Mod+Shift+S { spawn-sh "screenshot area"; } Mod+Ctrl+Shift+S { spawn-sh "screenshot window"; } diff --git a/quickshell/Assets/Config/.gitignore b/quickshell/Assets/Config/.gitignore index f1b0917..fe3dbf8 100644 --- a/quickshell/Assets/Config/.gitignore +++ b/quickshell/Assets/Config/.gitignore @@ -1,4 +1,4 @@ - +# some sensitive files Location.json - -GeoInfoToken.txt \ No newline at end of file +GeoInfoToken.txt +IpCache.json \ No newline at end of file diff --git a/quickshell/Constants/Style.qml b/quickshell/Constants/Style.qml index 6b4f9ad..6493e38 100644 --- a/quickshell/Constants/Style.qml +++ b/quickshell/Constants/Style.qml @@ -54,7 +54,7 @@ Singleton { property int animationFast: 150 property int animationNormal: 300 property int animationSlow: 450 - property int animationSlowest: 750 + property int animationSlowest: 1000 // Delays property int tooltipDelay: 300 property int tooltipDelayLong: 1200 diff --git a/quickshell/Modules/Bar/Bar.qml b/quickshell/Modules/Bar/Bar.qml index b96282e..bdc280f 100644 --- a/quickshell/Modules/Bar/Bar.qml +++ b/quickshell/Modules/Bar/Bar.qml @@ -54,7 +54,7 @@ Scope { Behavior on color { ColorAnimation { - duration: 1000 + duration: Style.animationSlowest easing.type: Easing.InOutCubic } @@ -68,7 +68,7 @@ Scope { Behavior on color { ColorAnimation { - duration: 1000 + duration: Style.animationSlowest easing.type: Easing.InOutCubic } @@ -234,14 +234,6 @@ Scope { Caffeine.manualToggle(); } - Behavior on buttonColor { - ColorAnimation { - duration: 500 - easing.type: Easing.InOutCubic - } - - } - } SymbolButton { diff --git a/quickshell/Services/IpService.qml b/quickshell/Services/IpService.qml index cb5a775..28cb59e 100644 --- a/quickshell/Services/IpService.qml +++ b/quickshell/Services/IpService.qml @@ -5,7 +5,7 @@ import qs.Utils pragma Singleton Singleton { - property string ip: "N/A" + property alias ip: cacheFileAdapter.ip property string countryCode: "N/A" property real fetchInterval: 30 // in s property real fetchTimeout: 10 // in s @@ -66,7 +66,7 @@ Singleton { if (xhr.status === 200) { try { const response = JSON.parse(xhr.responseText); - if (response && response.country) { + if (response && response.country_code) { let newCountryCode = response.country_code; Logger.log("IpService", "Fetched country code: " + newCountryCode); if (newCountryCode !== countryCode) { @@ -77,6 +77,9 @@ Singleton { countryCode = "N/A"; Logger.error("IpService", "Geo response does not contain 'country' field"); } + cacheFileAdapter.ip = ip; + cacheFileAdapter.geoInfo = response; + cacheFile.writeAdapter(); } catch (e) { countryCode = "N/A"; Logger.error("IpService", "Failed to parse geo response: " + e); @@ -123,6 +126,28 @@ Singleton { } } + FileView { + id: cacheFile + + path: Qt.resolvedUrl("../Assets/Config/IpCache.json") + watchChanges: false + onLoaded: { + Logger.log("IpService", "Loaded IP from cache file: " + cacheFileAdapter.ip); + if (cacheFileAdapter.geoInfo) { + countryCode = cacheFileAdapter.geoInfo.country_code || cacheFileAdapter.country || "N/A"; + Logger.log("IpService", "Loaded country code from cache file: " + countryCode); + } + } + + JsonAdapter { + id: cacheFileAdapter + + property string ip: "N/A" + property var geoInfo: null + } + + } + Timer { id: fetchTimer