forked from GH-forks/hyprfreeze
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
|
||||
- `jq` to parse json
|
||||
- `psmisc` contains 'pstree' which is required to list child processes
|
||||
- Systemd for the `loginctl` utility
|
||||
### 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
|
||||
### Highly Recommended
|
||||
|
|
18
hyprfreeze
18
hyprfreeze
|
@ -121,10 +121,20 @@ function getPidByProp() {
|
|||
}
|
||||
|
||||
function detectEnvironment() {
|
||||
local Desktop
|
||||
eval "$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Desktop)"
|
||||
[ -z "$Desktop" ] && echo "Could not determine desktop environment via \`loginctl\`. Assuming Hyprland." && Desktop="hyprland"
|
||||
DESKTOP=$Desktop
|
||||
if [ $(command -v loginctl) ]; then
|
||||
local Desktop
|
||||
eval "$(loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p 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() {
|
||||
|
|
Loading…
Reference in a new issue