hypr: migrate runtime IPC calls to the Hyprland 0.56 Lua syntax
Hyprland 0.56 removed the string form of `hyprctl dispatch` and `hyprctl keyword` entirely: the argument is now evaluated as Lua (hl.dispatch expects a dispatcher object from hl.dsp.*), and `setprop` lost the `noborder` property in favour of border_size 0. Everything that shelled out to these silently broke — wlogout's logout button did nothing, idle screen-off and lid-close DPMS died, borders stopped tracking single-window workspaces, and display mirroring was gone. All callers now use the documented forms: `hyprctl dispatch "hl.dsp.*"` for dispatchers and `hyprctl eval "hl.monitor(...)"` for monitor rules. dynamic-borders.sh gets a set_border() helper around the new window.set_prop dispatcher. wlogout layouts additionally cannot contain escaped quotes at all: it parses them with jsmn, which never unescapes strings, so \" used to reach the shell verbatim and break the command with a syntax error. Actions now use single quotes only.
This commit is contained in:
parent
04371578b6
commit
496fd6fc67
5 changed files with 35 additions and 21 deletions
|
|
@ -4,7 +4,7 @@ general {
|
||||||
before_sleep_cmd = loginctl lock-session
|
before_sleep_cmd = loginctl lock-session
|
||||||
# Small delay so the DRM/GPU is ready before re-enabling the display;
|
# Small delay so the DRM/GPU is ready before re-enabling the display;
|
||||||
# running `dpms on` immediately at resume is the classic cause of a black screen.
|
# running `dpms on` immediately at resume is the classic cause of a black screen.
|
||||||
after_sleep_cmd = sh -c 'sleep 2; hyprctl dispatch dpms on'
|
after_sleep_cmd = sh -c "sleep 2; hyprctl dispatch 'hl.dsp.dpms(\"on\")'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Step 1: Dim monitor at 115 sec idle (warning that it will lock soon)
|
# Step 1: Dim monitor at 115 sec idle (warning that it will lock soon)
|
||||||
|
|
@ -26,19 +26,19 @@ listener {
|
||||||
# Step 3: Turn screen off at 5 min idle
|
# Step 3: Turn screen off at 5 min idle
|
||||||
listener {
|
listener {
|
||||||
timeout = 300
|
timeout = 300
|
||||||
on-timeout = hyprctl dispatch dpms off && ddcutil setvcp 10 0
|
on-timeout = hyprctl dispatch "hl.dsp.dpms('off')" && ddcutil setvcp 10 0
|
||||||
|
|
||||||
# Explanation:
|
# Explanation:
|
||||||
# - hyprctl dispatch dpms off → tells the compositor to power off the display (DPMS standby)
|
# - hl.dsp.dpms("off") → tells the compositor to power off the display (DPMS standby)
|
||||||
# - ddcutil setvcp 10 0 → sets monitor brightness to 0 at the hardware level (safe for OLED)
|
# - ddcutil setvcp 10 0 → sets monitor brightness to 0 at the hardware level (safe for OLED)
|
||||||
#
|
#
|
||||||
# Both together ensure the screen is fully off visually and electrically
|
# Both together ensure the screen is fully off visually and electrically
|
||||||
|
|
||||||
# When the user becomes active again, restore display
|
# When the user becomes active again, restore display
|
||||||
on-resume = hyprctl dispatch dpms on && ddcutil setvcp 10 100 && wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
on-resume = hyprctl dispatch "hl.dsp.dpms('on')" && ddcutil setvcp 10 100 && wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||||
|
|
||||||
# Explanation:
|
# Explanation:
|
||||||
# - hyprctl dispatch dpms on → ensures the display is powered on by the compositor
|
# - hl.dsp.dpms("on") → ensures the display is powered on by the compositor
|
||||||
# - ddcutil setvcp 10 100 → restores monitor brightness to full
|
# - ddcutil setvcp 10 100 → restores monitor brightness to full
|
||||||
#
|
#
|
||||||
# Both together guarantee the screen wakes reliably on all monitors
|
# Both together guarantee the screen wakes reliably on all monitors
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Hyprland 0.56 removed the "noborder" window prop (use border_size 0) and
|
||||||
|
# "hyprctl dispatch <string>" — runtime props now go through the Lua API.
|
||||||
|
# Keep in sync with decoration.border_size in hyprland.lua.
|
||||||
|
BORDER_SIZE=3
|
||||||
|
|
||||||
|
# set_border <address> <1 = hide border, 0 = show border>
|
||||||
|
set_border() {
|
||||||
|
local hex=${1#address:}; hex=${hex#0x}
|
||||||
|
local size=0
|
||||||
|
[[ $2 == 0 ]] && size=$BORDER_SIZE
|
||||||
|
hyprctl dispatch "hl.dsp.window.set_prop({prop='border_size', value='$size', window='address:0x$hex'})" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
function handle {
|
function handle {
|
||||||
if [[ ${1:0:10} == "openwindow" ]]
|
if [[ ${1:0:10} == "openwindow" ]]
|
||||||
then
|
then
|
||||||
|
|
@ -16,9 +29,9 @@ function handle {
|
||||||
floating_status=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$window_id\" ) | .floating" )
|
floating_status=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$window_id\" ) | .floating" )
|
||||||
if [[ $floating_status == "false" ]]
|
if [[ $floating_status == "false" ]]
|
||||||
then
|
then
|
||||||
hyprctl dispatch setprop address:0x$window_id noborder 1
|
set_border "0x$window_id" 1
|
||||||
else
|
else
|
||||||
hyprctl dispatch setprop address:0x$window_id noborder 0
|
set_border "0x$window_id" 0
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -28,7 +41,7 @@ function handle {
|
||||||
for address in $addresses
|
for address in $addresses
|
||||||
do
|
do
|
||||||
if [[ "$address" != "$window_id" ]]; then
|
if [[ "$address" != "$window_id" ]]; then
|
||||||
hyprctl dispatch setprop address:$(echo $address | xargs) noborder 0
|
set_border "$(echo $address | xargs)" 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
@ -52,9 +65,9 @@ function handle {
|
||||||
floating_status=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$window_id\" ) | .floating" )
|
floating_status=$(hyprctl clients -j | jq ".[] | select(.address == \"0x$window_id\" ) | .floating" )
|
||||||
if [[ $floating_status == "false" ]]
|
if [[ $floating_status == "false" ]]
|
||||||
then
|
then
|
||||||
hyprctl dispatch setprop address:0x$window_id noborder 1
|
set_border "0x$window_id" 1
|
||||||
else
|
else
|
||||||
hyprctl dispatch setprop address:0x$window_id noborder 0
|
set_border "0x$window_id" 0
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [[ $windows -eq 2 ]]
|
elif [[ $windows -eq 2 ]]
|
||||||
|
|
@ -63,7 +76,7 @@ function handle {
|
||||||
for address in $addresses
|
for address in $addresses
|
||||||
do
|
do
|
||||||
if [[ "$address" != "$window_id" ]]; then
|
if [[ "$address" != "$window_id" ]]; then
|
||||||
hyprctl dispatch setprop address:$(echo $address | xargs) noborder 0
|
set_border "$(echo $address | xargs)" 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
@ -73,7 +86,7 @@ function handle {
|
||||||
for workspace in $single_window_workspaces
|
for workspace in $single_window_workspaces
|
||||||
do
|
do
|
||||||
window=$(hyprctl clients -j | jq ".[] | select(.workspace.id == $workspace) | .address")
|
window=$(hyprctl clients -j | jq ".[] | select(.workspace.id == $workspace) | .address")
|
||||||
hyprctl dispatch setprop address:$(echo $window | xargs) noborder 1
|
set_border "$(echo $window | xargs)" 1
|
||||||
done
|
done
|
||||||
|
|
||||||
elif [[ ${1:0:11} == "closewindow" ]]
|
elif [[ ${1:0:11} == "closewindow" ]]
|
||||||
|
|
@ -87,9 +100,9 @@ function handle {
|
||||||
floating_status=$(hyprctl activewindow -j | jq ".floating")
|
floating_status=$(hyprctl activewindow -j | jq ".floating")
|
||||||
if [[ $floating_status == "false" ]]
|
if [[ $floating_status == "false" ]]
|
||||||
then
|
then
|
||||||
hyprctl dispatch setprop address:$window_id noborder 1
|
set_border "$window_id" 1
|
||||||
else
|
else
|
||||||
hyprctl dispatch setprop address:$window_id noborder 0
|
set_border "$window_id" 0
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -102,14 +115,14 @@ function handle {
|
||||||
workspace_id=$(hyprctl clients -j | jq --arg address "$address" '.[] | select(.address == $address) | .workspace.id')
|
workspace_id=$(hyprctl clients -j | jq --arg address "$address" '.[] | select(.address == $address) | .workspace.id')
|
||||||
if [[ $floating_status -eq 1 ]]
|
if [[ $floating_status -eq 1 ]]
|
||||||
then
|
then
|
||||||
hyprctl dispatch setprop address:$address noborder 0
|
set_border "$address" 0
|
||||||
else
|
else
|
||||||
no_windows=$(hyprctl workspaces -j | jq ".[] | select(.id == $workspace_id) | .windows")
|
no_windows=$(hyprctl workspaces -j | jq ".[] | select(.id == $workspace_id) | .windows")
|
||||||
if [[ $no_windows -eq 1 ]]
|
if [[ $no_windows -eq 1 ]]
|
||||||
then
|
then
|
||||||
hyprctl dispatch setprop address:$address noborder 1
|
set_border "$address" 1
|
||||||
else
|
else
|
||||||
hyprctl dispatch setprop address:$address noborder 0
|
set_border "$address" 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@ pkill -x dim
|
||||||
hyprctl switchxkblayout all 0
|
hyprctl switchxkblayout all 0
|
||||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1
|
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1
|
||||||
pidof hyprlock || hyprlock --no-fade-in &
|
pidof hyprlock || hyprlock --no-fade-in &
|
||||||
hyprctl dispatch dpms off
|
hyprctl dispatch "hl.dsp.dpms('off')"
|
||||||
wait
|
wait
|
||||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ if [[ -n "$mirror_of" ]]; then
|
||||||
hyprctl reload
|
hyprctl reload
|
||||||
notify-send "Mirror" "Off — reverted to default layout"
|
notify-send "Mirror" "Off — reverted to default layout"
|
||||||
else
|
else
|
||||||
hyprctl keyword monitor "$external,preferred,auto,1,mirror,$internal"
|
# hl.monitor via eval replaces the removed `hyprctl keyword` (Hyprland 0.56)
|
||||||
|
hyprctl eval "hl.monitor({output='$external', mode='preferred', position='auto', scale=1, mirror='$internal'})"
|
||||||
notify-send "Mirror" "On — $internal → $external"
|
notify-send "Mirror" "On — $internal → $external"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"label" : "lock",
|
"label" : "lock",
|
||||||
"action" : "hyprctl dispatch exec hyprlock",
|
"action" : "hyprlock &",
|
||||||
"text" : "Lock",
|
"text" : "Lock",
|
||||||
"keybind" : "l"
|
"keybind" : "l"
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"label" : "logout",
|
"label" : "logout",
|
||||||
"action" : "hyprctl dispatch exit",
|
"action" : "hyprctl dispatch 'hl.dsp.exit()'",
|
||||||
"text" : "Logout",
|
"text" : "Logout",
|
||||||
"keybind" : "e"
|
"keybind" : "e"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue