@@ -37,6 +37,8 @@ local window_picker_candidates = {}
3737local stack_update_timer = nil
3838local monocle_notice = nil
3939local scratchpad_pending = {}
40+ local monitor_reserved_cache_path = (os.getenv (" XDG_RUNTIME_DIR" ) or " /tmp" ) .. " /hyprland-monitor-reserved.tsv"
41+ local scratchpad_fallback_reserved_top = 60
4042
4143hl .monitor ({
4244 output = " eDP-1" ,
@@ -228,6 +230,7 @@ local function apply_hyprwinview_config()
228230 hover_border_col = " rgba(66ccffee)" ,
229231 border_size = 3 ,
230232 window_order = " application" ,
233+ keys_filter_toggle = " /" ,
231234 show_app_icon = 1 ,
232235 app_icon_size = 48 ,
233236 app_icon_theme_source = " auto" ,
@@ -240,6 +243,13 @@ local function apply_hyprwinview_config()
240243 app_icon_offset_y = 0 ,
241244 app_icon_backplate_col = " rgba(00000066)" ,
242245 app_icon_backplate_padding = 6 ,
246+ show_window_text = 1 ,
247+ window_text_font = " Sans" ,
248+ window_text_size = 14 ,
249+ window_text_color = " rgba(ffffffff)" ,
250+ window_text_backplate_col = " rgba(00000099)" ,
251+ window_text_padding = 6 ,
252+ filter_animation_ms = 140 ,
243253 animation = " workspace_zoom" ,
244254 animation_in_ms = 280 ,
245255 animation_out_ms = 220 ,
@@ -262,6 +272,7 @@ local function apply_hyprwinview_config()
262272 bring = { " b" , " shift+return" , " shift+space" },
263273 bring_replace = { " shift + b" },
264274 close = { " escape" , " q" },
275+ filter_toggle = { " /" },
265276 },
266277 })
267278 end
@@ -1199,10 +1210,70 @@ local function logical_monitor_dimension(value, scale)
11991210 return math.floor ((value / scale ) + 0.5 )
12001211end
12011212
1213+ local function shell_quote (value )
1214+ return " '" .. tostring (value ):gsub (" '" , " '\\ ''" ) .. " '"
1215+ end
1216+
1217+ local function split_tsv (line )
1218+ local fields = {}
1219+ for field in (line .. " \t " ):gmatch (" ([^\t ]*)\t " ) do
1220+ fields [# fields + 1 ] = field
1221+ end
1222+ return fields
1223+ end
1224+
1225+ local function monitor_from_reserved_cache (monitor )
1226+ if verify_config or not monitor or not monitor .name then
1227+ return nil
1228+ end
1229+
1230+ local file = io.open (monitor_reserved_cache_path , " r" )
1231+ if not file then
1232+ return nil
1233+ end
1234+
1235+ local cached = nil
1236+ for line in file :lines () do
1237+ local fields = split_tsv (line )
1238+ if fields [1 ] == monitor .name and # fields >= 10 then
1239+ cached = {
1240+ name = monitor .name ,
1241+ x = tonumber (fields [2 ]),
1242+ y = tonumber (fields [3 ]),
1243+ width = tonumber (fields [4 ]),
1244+ height = tonumber (fields [5 ]),
1245+ scale = tonumber (fields [6 ]),
1246+ reserved = {
1247+ tonumber (fields [7 ]),
1248+ tonumber (fields [8 ]),
1249+ tonumber (fields [9 ]),
1250+ tonumber (fields [10 ]),
1251+ },
1252+ }
1253+ break
1254+ end
1255+ end
1256+ file :close ()
1257+ return cached
1258+ end
1259+
1260+ local function refresh_monitor_reserved_cache (delay )
1261+ if verify_config then
1262+ return
1263+ end
1264+
1265+ local command = string.format (
1266+ [=[ 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"]=] ,
1267+ as_number (delay , 0 )
1268+ )
1269+ hl .exec_cmd (" sh -lc " .. shell_quote (command ))
1270+ end
1271+
12021272local function monitor_workarea (monitor )
1273+ monitor = monitor_from_reserved_cache (monitor ) or monitor
12031274 local width = logical_monitor_dimension (monitor .width , monitor .scale )
12041275 local height = logical_monitor_dimension (monitor .height , monitor .scale )
1205- local reserved = monitor .reserved or {}
1276+ local reserved = monitor .reserved or { 0 , scratchpad_fallback_reserved_top , 0 , 0 }
12061277 local left = math.floor (as_number (reserved [1 ], 0 ))
12071278 local top = math.floor (as_number (reserved [2 ], 0 ))
12081279 local right = math.floor (as_number (reserved [3 ], 0 ))
@@ -1331,6 +1402,22 @@ local function hide_active_scratchpads(except_name)
13311402 end
13321403end
13331404
1405+ local function refresh_active_scratchpad_geometries ()
1406+ local monitor = hl .get_active_monitor ()
1407+ for _ , active in ipairs (active_scratchpad_windows ()) do
1408+ schedule_scratchpad_geometry (active .name , active .window , monitor )
1409+ end
1410+ end
1411+
1412+ local function refresh_active_scratchpad_geometries_later (timeout )
1413+ hl .timer (refresh_active_scratchpad_geometries , { timeout = timeout or 300 , type = " oneshot" })
1414+ end
1415+
1416+ local function refresh_shell_workarea_and_scratchpads ()
1417+ refresh_monitor_reserved_cache (0.15 )
1418+ refresh_active_scratchpad_geometries_later (400 )
1419+ end
1420+
13341421local function adopt_matching_scratchpad_window (window )
13351422 if not window then
13361423 return
@@ -1884,6 +1971,7 @@ bind(main_mod .. " + E", exec("emacsclient --eval '(emacs-everywhere)'"))
18841971bind (main_mod .. " + V" , exec (" wl-paste | xdotool type --file -" ))
18851972bind (main_mod .. " + Tab" , hyprwinview (" toggle" ))
18861973bind (main_mod .. " + SHIFT + Tab" , hyprwinview (" toggle other-workspaces" ))
1974+ bind (main_mod .. " + SHIFT + slash" , hyprwinview (" toggle filter" ))
18871975bind (" ALT + Tab" , hyprexpo (" toggle" ))
18881976bind (" ALT + SHIFT + Tab" , hyprexpo (" bring" ))
18891977bind (main_mod .. " + G" , exec (shell_ui_command .. " window go" ))
@@ -2036,9 +2124,6 @@ end)
20362124bind (mod_alt .. " + grave" , function ()
20372125 toggle_scratchpad (" dropdown" )
20382126end )
2039- bind (mod_alt .. " + C" , function ()
2040- raise_or_spawn (" google-chrome" , " google-chrome-stable" )
2041- end )
20422127bind (mod_alt .. " + Space" , minimize_other_classes )
20432128bind (mod_alt .. " + SHIFT + Space" , restore_focused_class )
20442129bind (mod_alt .. " + Return" , restore_all_minimized )
@@ -2088,12 +2173,16 @@ bind("XF86MonBrightnessDown", exec("brightness.sh down"), { repeating = true })
20882173bind (hyper .. " + V" , exec ([[ cliphist list | rofi -dmenu -p "Clipboard" | cliphist decode | wl-copy]] ))
20892174bind (hyper .. " + P" , exec (" rofi-pass" ))
20902175bind (hyper .. " + H" , exec ([[ grim -g "$(slurp)" - | swappy -f -]] ))
2091- bind (hyper .. " + C" , exec (" shell_command .sh" ))
2176+ bind (hyper .. " + C" , exec (" rofi_tmcodex .sh" ))
20922177bind (hyper .. " + SHIFT + L" , exec (" hyprlock" ))
20932178bind (hyper .. " + K" , exec (" rofi_kill_process.sh" ))
20942179bind (hyper .. " + SHIFT + K" , exec (" rofi_kill_all.sh" ))
20952180bind (hyper .. " + R" , exec (" rofi-systemd" ))
2096- bind (hyper .. " + slash" , exec (" toggle_taffybar" ))
2181+ bind (hyper .. " + slash" , function ()
2182+ hl .exec_cmd (" toggle_taffybar" )
2183+ refresh_monitor_reserved_cache (0.25 )
2184+ refresh_active_scratchpad_geometries_later (600 )
2185+ end )
20972186bind (hyper .. " + I" , exec (" rofi_select_input.hs" ))
20982187bind (hyper .. " + backslash" , exec (" /home/imalison/dotfiles/dotfiles/lib/functions/mpg341cx_input toggle" ))
20992188bind (hyper .. " + SHIFT + backslash" , workspacehistory (" debug" ))
@@ -2117,12 +2206,15 @@ hl.on("hyprland.start", function()
21172206 hl .exec_cmd (" wl-paste --type image --watch cliphist store" )
21182207 write_layout_state ()
21192208 schedule_nstack_count_update ()
2209+ refresh_monitor_reserved_cache (0.25 )
2210+ refresh_monitor_reserved_cache (1.25 )
21202211end )
21212212
21222213hl .on (" config.reloaded" , apply_nstack_config )
21232214hl .on (" config.reloaded" , apply_hyprexpo_config )
21242215hl .on (" config.reloaded" , apply_hyprwinview_config )
21252216hl .on (" config.reloaded" , apply_rules )
2217+ hl .on (" config.reloaded" , refresh_shell_workarea_and_scratchpads )
21262218
21272219hl .on (" window.open" , schedule_nstack_count_update )
21282220hl .on (" window.destroy" , schedule_nstack_count_update )
0 commit comments