Quick access to ipython and btop using special workspaces

This commit is contained in:
Wekuz 2026-05-30 12:23:56 +03:00
parent c22af8b1cd
commit 0f0665fa0e
Signed by: Wekuz
GPG key ID: 2E502F2AABD32DF9

View file

@ -275,7 +275,30 @@ local function layout_bind(bind_table)
end
end
---@param workspace_name string
---@param window_cmd string
---@param window_rules table
local function scratchpad(workspace_name, window_cmd, window_rules)
if window_rules["workspace"] then
window_rules["workspace"] = "special:" .. workspace_name
end
return function()
hl.dispatch(hl.dsp.workspace.toggle_special(workspace_name))
local activeSpecialWorkspace = hl.get_active_special_workspace()
if activeSpecialWorkspace ~= nil and activeSpecialWorkspace.name == "special:" .. workspace_name then
if activeSpecialWorkspace.is_empty then
hl.dispatch(hl.dsp.exec_cmd(window_cmd, window_rules))
end
end
end
end
hl.bind("SUPER + RETURN", hl.dsp.exec_cmd(terminal))
hl.bind("SUPER + ALT + C",
scratchpad("calculator", "kitty ipython --no-banner",
{ float = true, size = { "(monitor_w*0.3)", "(monitor_h*0.4)" }, center = true }))
hl.bind("SUPER + ALT + V", scratchpad("btop", "kitty btop", {}))
hl.bind("SUPER + Q", hl.dsp.exec_cmd(browser))
hl.bind("SUPER + W", hl.dsp.window.close())
hl.bind("SUPER + SHIFT + ALT + Q", hl.dsp.exit())
@ -289,14 +312,14 @@ hl.bind("SUPER + CTRL + ALT + L", hl.dsp.exec_cmd(hyprlock))
-- Cliphist
hl.bind("SUPER + V",
hl.dsp.exec_cmd(
"pkill fuzzel || cliphist list | uwsm-app -- fuzzel -d -w 75 --select-index 1 | cliphist decode | wl-copy"))
"pkill fuzzel || cliphist list | uwsm-app -- fuzzel -d -w 75 --select-index 1 | cliphist decode | wl-copy"))
-- Hyprshot
hl.bind("SUPER + SHIFT + S", hl.dsp.exec_cmd(hyprshot .. "-m region --clipboard-only"))
hl.bind("SUPER + SHIFT + CTRL + S", hl.dsp.exec_cmd(hyprshot .. "-m window --clipboard-only"))
hl.bind("SUPER + SHIFT + ALT + S", hl.dsp.exec_cmd(hyprshot .. "-m output --clipboard-only"))
hl.bind("SUPER + SHIFT + B",
hl.dsp.exec_cmd(
"pkill fuzzel || bluetoothctl -- connect \"$(bluetoothctl -- devices Paired | cut -f2- -d ' ' | uwsm-app -- fuzzel -d -l 8 | cut -f1 -d ' ')\""))
"pkill fuzzel || bluetoothctl -- connect \"$(bluetoothctl -- devices Paired | cut -f2- -d ' ' | uwsm-app -- fuzzel -d -l 8 | cut -f1 -d ' ')\""))
hl.bind("SUPER + SHIFT + A", hl.dsp.exec_cmd("sh ~/scripts/select-audio-sink.sh"))
-- Move focus
@ -376,9 +399,8 @@ hl.bind("SUPER + F18", hl.dsp.exec_cmd("pkill wvkbd-deskintl || uwsm-app -- wvkb
hl.window_rule({
name = "no-border-single-window",
match = {
workspace = "w[1]",
class = "negative:^(steam)$",
title = "negative:Steam"
workspace = "w[1]s[false]",
class = "negative:^(steam)$"
},
border_size = 0
@ -388,7 +410,7 @@ hl.window_rule({
hl.window_rule({
name = "no-border-fullscreen",
match = {
workspace = "f[1-2]",
workspace = "f[1-2]s[false]"
},
border_size = 0
@ -398,44 +420,44 @@ hl.window_rule({
name = "pavucontrol-float",
match = {
class = "^(org.pulseaudio.pavucontrol)$",
title = "^(Volume Control)$",
title = "^(Volume Control)$"
},
float = 1,
center = 1,
size = {
"0.35*monitor_w",
"0.4*monitor_h",
},
"0.4*monitor_h"
}
})
hl.window_rule({
name = "showmethekey-float",
match = {
class = "^(showmethekey-gtk)$",
class = "^(showmethekey-gtk)$"
},
float = 1,
border_size = 0,
border_size = 0
})
hl.window_rule({
name = "steam-popup-float",
match = {
class = "^(steam)$",
title = "negative:Steam",
title = "negative:Steam"
},
float = 1,
float = 1
})
hl.window_rule({
name = "gaming",
match = {
class = "^(steam_app_\\d+|cs2)$",
class = "^(steam_app_\\d+|cs2)$"
},
workspace = 10,
immediate = 1,
fullscreen = 1,
fullscreen = 1
})