mirror of
https://github.com/Zerodya/hyprfreeze.git
synced 2024-11-09 17:08:49 +01:00
feat: fall back to $XDG_SESSION_DESKTOP
for detection
This commit is contained in:
parent
a119f872fe
commit
c894c76305
2 changed files with 14 additions and 5 deletions
|
@ -19,7 +19,6 @@ Hyprfreeze is available in [AUR](https://aur.archlinux.org/packages/hyprfreeze-g
|
||||||
- a compatible window manager (`hyprland` or `sway`) to get the PID of the active window
|
- a compatible window manager (`hyprland` or `sway`) to get the PID of the active window
|
||||||
- `jq` to parse json
|
- `jq` to parse json
|
||||||
- `psmisc` contains 'pstree' which is required to list child processes
|
- `psmisc` contains 'pstree' which is required to list child processes
|
||||||
- Systemd for the `loginctl` utility
|
|
||||||
### Optional
|
### Optional
|
||||||
- [`hyprprop`](https://github.com/vilari-mickopf/hyprprop) or [`swayprop`](https://git.alternerd.tv/alterNERDtive/swayprop) to get the pid of a window by selecting it with your mouse
|
- [`hyprprop`](https://github.com/vilari-mickopf/hyprprop) or [`swayprop`](https://git.alternerd.tv/alterNERDtive/swayprop) to get the pid of a window by selecting it with your mouse
|
||||||
### Highly Recommended
|
### Highly Recommended
|
||||||
|
|
18
hyprfreeze
18
hyprfreeze
|
@ -121,10 +121,20 @@ function getPidByProp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectEnvironment() {
|
function detectEnvironment() {
|
||||||
local Desktop
|
if [ $(command -v loginctl) ]; then
|
||||||
eval "$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Desktop)"
|
local Desktop
|
||||||
[ -z "$Desktop" ] && echo "Could not determine desktop environment via \`loginctl\`. Assuming Hyprland." && Desktop="hyprland"
|
eval "$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Desktop)"
|
||||||
DESKTOP=$Desktop
|
DESKTOP=$Desktop
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DESKTOP" ]; then
|
||||||
|
DESKTOP=$XDG_SESSION_DESKTOP
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DESKTOP" ]; then
|
||||||
|
debugPrint "Could not determine desktop environment via \`loginctl\`, and `$XDG_DESKTOP_SESSION` is not set. Assuming Hyprland."
|
||||||
|
DESKTOP="hyprland"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function printInfo() {
|
function printInfo() {
|
||||||
|
|
Loading…
Reference in a new issue