Propagate desktop config updates
This commit is contained in:
@@ -37,6 +37,8 @@ local window_picker_candidates = {}
|
|||||||
local stack_update_timer = nil
|
local stack_update_timer = nil
|
||||||
local monocle_notice = nil
|
local monocle_notice = nil
|
||||||
local scratchpad_pending = {}
|
local scratchpad_pending = {}
|
||||||
|
local monitor_reserved_cache_path = (os.getenv("XDG_RUNTIME_DIR") or "/tmp") .. "/hyprland-monitor-reserved.tsv"
|
||||||
|
local scratchpad_fallback_reserved_top = 60
|
||||||
|
|
||||||
hl.monitor({
|
hl.monitor({
|
||||||
output = "eDP-1",
|
output = "eDP-1",
|
||||||
@@ -228,6 +230,7 @@ local function apply_hyprwinview_config()
|
|||||||
hover_border_col = "rgba(66ccffee)",
|
hover_border_col = "rgba(66ccffee)",
|
||||||
border_size = 3,
|
border_size = 3,
|
||||||
window_order = "application",
|
window_order = "application",
|
||||||
|
keys_filter_toggle = "/",
|
||||||
show_app_icon = 1,
|
show_app_icon = 1,
|
||||||
app_icon_size = 48,
|
app_icon_size = 48,
|
||||||
app_icon_theme_source = "auto",
|
app_icon_theme_source = "auto",
|
||||||
@@ -240,6 +243,13 @@ local function apply_hyprwinview_config()
|
|||||||
app_icon_offset_y = 0,
|
app_icon_offset_y = 0,
|
||||||
app_icon_backplate_col = "rgba(00000066)",
|
app_icon_backplate_col = "rgba(00000066)",
|
||||||
app_icon_backplate_padding = 6,
|
app_icon_backplate_padding = 6,
|
||||||
|
show_window_text = 1,
|
||||||
|
window_text_font = "Sans",
|
||||||
|
window_text_size = 14,
|
||||||
|
window_text_color = "rgba(ffffffff)",
|
||||||
|
window_text_backplate_col = "rgba(00000099)",
|
||||||
|
window_text_padding = 6,
|
||||||
|
filter_animation_ms = 140,
|
||||||
animation = "workspace_zoom",
|
animation = "workspace_zoom",
|
||||||
animation_in_ms = 280,
|
animation_in_ms = 280,
|
||||||
animation_out_ms = 220,
|
animation_out_ms = 220,
|
||||||
@@ -262,6 +272,7 @@ local function apply_hyprwinview_config()
|
|||||||
bring = { "b", "shift+return", "shift+space" },
|
bring = { "b", "shift+return", "shift+space" },
|
||||||
bring_replace = { "shift + b" },
|
bring_replace = { "shift + b" },
|
||||||
close = { "escape", "q" },
|
close = { "escape", "q" },
|
||||||
|
filter_toggle = { "/" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -1199,10 +1210,70 @@ local function logical_monitor_dimension(value, scale)
|
|||||||
return math.floor((value / scale) + 0.5)
|
return math.floor((value / scale) + 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function shell_quote(value)
|
||||||
|
return "'" .. tostring(value):gsub("'", "'\\''") .. "'"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function split_tsv(line)
|
||||||
|
local fields = {}
|
||||||
|
for field in (line .. "\t"):gmatch("([^\t]*)\t") do
|
||||||
|
fields[#fields + 1] = field
|
||||||
|
end
|
||||||
|
return fields
|
||||||
|
end
|
||||||
|
|
||||||
|
local function monitor_from_reserved_cache(monitor)
|
||||||
|
if verify_config or not monitor or not monitor.name then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local file = io.open(monitor_reserved_cache_path, "r")
|
||||||
|
if not file then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local cached = nil
|
||||||
|
for line in file:lines() do
|
||||||
|
local fields = split_tsv(line)
|
||||||
|
if fields[1] == monitor.name and #fields >= 10 then
|
||||||
|
cached = {
|
||||||
|
name = monitor.name,
|
||||||
|
x = tonumber(fields[2]),
|
||||||
|
y = tonumber(fields[3]),
|
||||||
|
width = tonumber(fields[4]),
|
||||||
|
height = tonumber(fields[5]),
|
||||||
|
scale = tonumber(fields[6]),
|
||||||
|
reserved = {
|
||||||
|
tonumber(fields[7]),
|
||||||
|
tonumber(fields[8]),
|
||||||
|
tonumber(fields[9]),
|
||||||
|
tonumber(fields[10]),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
file:close()
|
||||||
|
return cached
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh_monitor_reserved_cache(delay)
|
||||||
|
if verify_config then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local command = string.format(
|
||||||
|
[=[sleep %.2f; cache="${XDG_RUNTIME_DIR:-/tmp}/hyprland-monitor-reserved.tsv"; tmp="$cache.tmp"; /run/current-system/sw/bin/hyprctl -j monitors 2>/dev/null | /run/current-system/sw/bin/jq -r '.[] | [.name, .x, .y, .width, .height, .scale, .reserved[0], .reserved[1], .reserved[2], .reserved[3]] | @tsv' > "$tmp" && mv "$tmp" "$cache"]=],
|
||||||
|
as_number(delay, 0)
|
||||||
|
)
|
||||||
|
hl.exec_cmd("sh -lc " .. shell_quote(command))
|
||||||
|
end
|
||||||
|
|
||||||
local function monitor_workarea(monitor)
|
local function monitor_workarea(monitor)
|
||||||
|
monitor = monitor_from_reserved_cache(monitor) or monitor
|
||||||
local width = logical_monitor_dimension(monitor.width, monitor.scale)
|
local width = logical_monitor_dimension(monitor.width, monitor.scale)
|
||||||
local height = logical_monitor_dimension(monitor.height, monitor.scale)
|
local height = logical_monitor_dimension(monitor.height, monitor.scale)
|
||||||
local reserved = monitor.reserved or {}
|
local reserved = monitor.reserved or { 0, scratchpad_fallback_reserved_top, 0, 0 }
|
||||||
local left = math.floor(as_number(reserved[1], 0))
|
local left = math.floor(as_number(reserved[1], 0))
|
||||||
local top = math.floor(as_number(reserved[2], 0))
|
local top = math.floor(as_number(reserved[2], 0))
|
||||||
local right = math.floor(as_number(reserved[3], 0))
|
local right = math.floor(as_number(reserved[3], 0))
|
||||||
@@ -1331,6 +1402,22 @@ local function hide_active_scratchpads(except_name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function refresh_active_scratchpad_geometries()
|
||||||
|
local monitor = hl.get_active_monitor()
|
||||||
|
for _, active in ipairs(active_scratchpad_windows()) do
|
||||||
|
schedule_scratchpad_geometry(active.name, active.window, monitor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh_active_scratchpad_geometries_later(timeout)
|
||||||
|
hl.timer(refresh_active_scratchpad_geometries, { timeout = timeout or 300, type = "oneshot" })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function refresh_shell_workarea_and_scratchpads()
|
||||||
|
refresh_monitor_reserved_cache(0.15)
|
||||||
|
refresh_active_scratchpad_geometries_later(400)
|
||||||
|
end
|
||||||
|
|
||||||
local function adopt_matching_scratchpad_window(window)
|
local function adopt_matching_scratchpad_window(window)
|
||||||
if not window then
|
if not window then
|
||||||
return
|
return
|
||||||
@@ -1884,6 +1971,7 @@ bind(main_mod .. " + E", exec("emacsclient --eval '(emacs-everywhere)'"))
|
|||||||
bind(main_mod .. " + V", exec("wl-paste | xdotool type --file -"))
|
bind(main_mod .. " + V", exec("wl-paste | xdotool type --file -"))
|
||||||
bind(main_mod .. " + Tab", hyprwinview("toggle"))
|
bind(main_mod .. " + Tab", hyprwinview("toggle"))
|
||||||
bind(main_mod .. " + SHIFT + Tab", hyprwinview("toggle other-workspaces"))
|
bind(main_mod .. " + SHIFT + Tab", hyprwinview("toggle other-workspaces"))
|
||||||
|
bind(main_mod .. " + SHIFT + slash", hyprwinview("toggle filter"))
|
||||||
bind("ALT + Tab", hyprexpo("toggle"))
|
bind("ALT + Tab", hyprexpo("toggle"))
|
||||||
bind("ALT + SHIFT + Tab", hyprexpo("bring"))
|
bind("ALT + SHIFT + Tab", hyprexpo("bring"))
|
||||||
bind(main_mod .. " + G", exec(shell_ui_command .. " window go"))
|
bind(main_mod .. " + G", exec(shell_ui_command .. " window go"))
|
||||||
@@ -2036,9 +2124,6 @@ end)
|
|||||||
bind(mod_alt .. " + grave", function()
|
bind(mod_alt .. " + grave", function()
|
||||||
toggle_scratchpad("dropdown")
|
toggle_scratchpad("dropdown")
|
||||||
end)
|
end)
|
||||||
bind(mod_alt .. " + C", function()
|
|
||||||
raise_or_spawn("google-chrome", "google-chrome-stable")
|
|
||||||
end)
|
|
||||||
bind(mod_alt .. " + Space", minimize_other_classes)
|
bind(mod_alt .. " + Space", minimize_other_classes)
|
||||||
bind(mod_alt .. " + SHIFT + Space", restore_focused_class)
|
bind(mod_alt .. " + SHIFT + Space", restore_focused_class)
|
||||||
bind(mod_alt .. " + Return", restore_all_minimized)
|
bind(mod_alt .. " + Return", restore_all_minimized)
|
||||||
@@ -2088,12 +2173,16 @@ bind("XF86MonBrightnessDown", exec("brightness.sh down"), { repeating = true })
|
|||||||
bind(hyper .. " + V", exec([[cliphist list | rofi -dmenu -p "Clipboard" | cliphist decode | wl-copy]]))
|
bind(hyper .. " + V", exec([[cliphist list | rofi -dmenu -p "Clipboard" | cliphist decode | wl-copy]]))
|
||||||
bind(hyper .. " + P", exec("rofi-pass"))
|
bind(hyper .. " + P", exec("rofi-pass"))
|
||||||
bind(hyper .. " + H", exec([[grim -g "$(slurp)" - | swappy -f -]]))
|
bind(hyper .. " + H", exec([[grim -g "$(slurp)" - | swappy -f -]]))
|
||||||
bind(hyper .. " + C", exec("shell_command.sh"))
|
bind(hyper .. " + C", exec("rofi_tmcodex.sh"))
|
||||||
bind(hyper .. " + SHIFT + L", exec("hyprlock"))
|
bind(hyper .. " + SHIFT + L", exec("hyprlock"))
|
||||||
bind(hyper .. " + K", exec("rofi_kill_process.sh"))
|
bind(hyper .. " + K", exec("rofi_kill_process.sh"))
|
||||||
bind(hyper .. " + SHIFT + K", exec("rofi_kill_all.sh"))
|
bind(hyper .. " + SHIFT + K", exec("rofi_kill_all.sh"))
|
||||||
bind(hyper .. " + R", exec("rofi-systemd"))
|
bind(hyper .. " + R", exec("rofi-systemd"))
|
||||||
bind(hyper .. " + slash", exec("toggle_taffybar"))
|
bind(hyper .. " + slash", function()
|
||||||
|
hl.exec_cmd("toggle_taffybar")
|
||||||
|
refresh_monitor_reserved_cache(0.25)
|
||||||
|
refresh_active_scratchpad_geometries_later(600)
|
||||||
|
end)
|
||||||
bind(hyper .. " + I", exec("rofi_select_input.hs"))
|
bind(hyper .. " + I", exec("rofi_select_input.hs"))
|
||||||
bind(hyper .. " + backslash", exec("/home/imalison/dotfiles/dotfiles/lib/functions/mpg341cx_input toggle"))
|
bind(hyper .. " + backslash", exec("/home/imalison/dotfiles/dotfiles/lib/functions/mpg341cx_input toggle"))
|
||||||
bind(hyper .. " + SHIFT + backslash", workspacehistory("debug"))
|
bind(hyper .. " + SHIFT + backslash", workspacehistory("debug"))
|
||||||
@@ -2117,12 +2206,15 @@ hl.on("hyprland.start", function()
|
|||||||
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||||
write_layout_state()
|
write_layout_state()
|
||||||
schedule_nstack_count_update()
|
schedule_nstack_count_update()
|
||||||
|
refresh_monitor_reserved_cache(0.25)
|
||||||
|
refresh_monitor_reserved_cache(1.25)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hl.on("config.reloaded", apply_nstack_config)
|
hl.on("config.reloaded", apply_nstack_config)
|
||||||
hl.on("config.reloaded", apply_hyprexpo_config)
|
hl.on("config.reloaded", apply_hyprexpo_config)
|
||||||
hl.on("config.reloaded", apply_hyprwinview_config)
|
hl.on("config.reloaded", apply_hyprwinview_config)
|
||||||
hl.on("config.reloaded", apply_rules)
|
hl.on("config.reloaded", apply_rules)
|
||||||
|
hl.on("config.reloaded", refresh_shell_workarea_and_scratchpads)
|
||||||
|
|
||||||
hl.on("window.open", schedule_nstack_count_update)
|
hl.on("window.open", schedule_nstack_count_update)
|
||||||
hl.on("window.destroy", schedule_nstack_count_update)
|
hl.on("window.destroy", schedule_nstack_count_update)
|
||||||
|
|||||||
6
dotfiles/config/taffybar/flake.lock
generated
6
dotfiles/config/taffybar/flake.lock
generated
@@ -136,11 +136,11 @@
|
|||||||
"xmonad-contrib": "xmonad-contrib"
|
"xmonad-contrib": "xmonad-contrib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777957173,
|
"lastModified": 1777963658,
|
||||||
"narHash": "sha256-lI53lwhWcno7kwAkthtiK6MzAzK9BSShi8KVr5TxX44=",
|
"narHash": "sha256-ZmIB9XreL99khpPXCYB+LP24/ovMRSQ5DMtJj0ySO4Y=",
|
||||||
"owner": "taffybar",
|
"owner": "taffybar",
|
||||||
"repo": "taffybar",
|
"repo": "taffybar",
|
||||||
"rev": "54498ffead7586df06e308275c0ea48cfbb74ea3",
|
"rev": "b078f1d47fbb71d03843d7c3d9320c128b6bc5a1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
Submodule dotfiles/config/taffybar/taffybar updated: 54498ffead...b078f1d47f
@@ -250,7 +250,6 @@ virtualClasses =
|
|||||||
|
|
||||||
-- Commands
|
-- Commands
|
||||||
|
|
||||||
chromeCommand = "google-chrome-stable"
|
|
||||||
elementCommand = "element-desktop"
|
elementCommand = "element-desktop"
|
||||||
emacsCommand = "emacsclient -c"
|
emacsCommand = "emacsclient -c"
|
||||||
htopCommand = "ghostty --title=htop -e htop"
|
htopCommand = "ghostty --title=htop -e htop"
|
||||||
@@ -1004,11 +1003,6 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
buildDirectionalBindings
|
buildDirectionalBindings
|
||||||
(hyper .|. shiftMask) (followingWindow . (`screenSwap` True)) ++
|
(hyper .|. shiftMask) (followingWindow . (`screenSwap` True)) ++
|
||||||
|
|
||||||
-- Specific program spawning
|
|
||||||
bindBringAndRaiseMany
|
|
||||||
[ (modalt, xK_c, spawn chromeCommand, chromeSelector)
|
|
||||||
] ++
|
|
||||||
|
|
||||||
-- ScratchPads
|
-- ScratchPads
|
||||||
[ ((modalt, xK_e), doScratchpad "element")
|
[ ((modalt, xK_e), doScratchpad "element")
|
||||||
, ((modalt, xK_h), doScratchpad "htop")
|
, ((modalt, xK_h), doScratchpad "htop")
|
||||||
@@ -1072,7 +1066,7 @@ addKeys conf@XConfig { modMask = modm } =
|
|||||||
, ((hyper, xK_v), spawn "rofi -modi 'clipboard:greenclip print' -show clipboard")
|
, ((hyper, xK_v), spawn "rofi -modi 'clipboard:greenclip print' -show clipboard")
|
||||||
, ((hyper, xK_p), spawn "rofi-pass")
|
, ((hyper, xK_p), spawn "rofi-pass")
|
||||||
, ((hyper, xK_h), spawn "rofi_shutter")
|
, ((hyper, xK_h), spawn "rofi_shutter")
|
||||||
, ((hyper, xK_c), spawn "shell_command.sh")
|
, ((hyper, xK_c), spawn "rofi_tmcodex.sh")
|
||||||
, ((hyper .|. shiftMask, xK_l), spawn "dm-tool lock")
|
, ((hyper .|. shiftMask, xK_l), spawn "dm-tool lock")
|
||||||
, ((hyper, xK_l), selectLayout)
|
, ((hyper, xK_l), selectLayout)
|
||||||
, ((hyper, xK_k), spawn "rofi_kill_process.sh")
|
, ((hyper, xK_k), spawn "rofi_kill_process.sh")
|
||||||
|
|||||||
4
nixos/flake.lock
generated
4
nixos/flake.lock
generated
@@ -1934,8 +1934,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777956479,
|
"lastModified": 1777963173,
|
||||||
"narHash": "sha256-KJV5ZJje4/N8Q3umMz7LY+MNg+P4ZRc/vepw7gNcvxo=",
|
"narHash": "sha256-At2JSNKt4BhGMmRz+fy6T1DxkFQOocN3fIcto5qmz1c=",
|
||||||
"path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar",
|
"path": "/home/imalison/dotfiles/dotfiles/config/taffybar/taffybar",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -532,7 +532,7 @@
|
|||||||
} ''
|
} ''
|
||||||
cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua
|
cp ${../dotfiles/config/hypr/hyprland.lua} hyprland.lua
|
||||||
luac -p hyprland.lua
|
luac -p hyprland.lua
|
||||||
if grep -n 'hyprctl' hyprland.lua | grep -v 'hyprctl reload' | grep -v 'hyprctl dispatch hyprwinview:overview'; then
|
if grep -n 'hyprctl' hyprland.lua | grep -v 'hyprctl reload' | grep -v 'hyprctl dispatch hyprwinview:overview' | grep -v 'hyprctl -j monitors'; then
|
||||||
echo "hyprland.lua should not shell out to hyprctl for window/workspace manipulation" >&2
|
echo "hyprland.lua should not shell out to hyprctl for window/workspace manipulation" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user