Better bindings
This commit is contained in:
+76
-14
@@ -25,6 +25,10 @@ local function bindlr(key, cmd, desc, opts)
|
||||
bindl(key, cmd, desc, opts)
|
||||
end
|
||||
|
||||
local function notify(text)
|
||||
hl.notification.create({ text = text, duration = 2000 })
|
||||
end
|
||||
|
||||
-- Laptop multimedia keys for volume and LCD brightness (with OSD)
|
||||
bindlr("XF86AudioRaiseVolume", exec(osdclient .. " --output-volume raise"), "Volume up")
|
||||
bindlr("XF86AudioRaiseVolume", exec(osdclient .. " --output-volume raise"), "Volume up")
|
||||
@@ -70,8 +74,53 @@ bind("SUPER + Q", hl.dsp.window.close(), "Close window")
|
||||
bind("SUPER + P", hl.dsp.window.pseudo()--[[# dwindle]], "Pseudo window")
|
||||
bind("SUPER + F", hl.dsp.window.fullscreen(0), "Full screen")
|
||||
bind("SUPER + CTRL + F", hl.dsp.window.fullscreen(1), "Full width")
|
||||
bind("SUPER + T", exec("station-hyprland-window-pop"), "Pop window out (float & pin)")
|
||||
bind("SUPER + CTRL + L", exec("station-hyprland-workspace-layout-toggle"), "Toggle workspace layout")
|
||||
bind("SUPER + T", function()
|
||||
local width = 1300
|
||||
local height = 900
|
||||
local pinned = hl.get_active_window().pinned
|
||||
|
||||
if pinned then
|
||||
hl.dispatch(hl.dsp.window.pin())
|
||||
hl.dispatch(hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.dispatch(hl.dsp.window.tag({ tag = "-pop" }))
|
||||
else
|
||||
hl.dispatch(hl.dsp.window.float({ action = "toggle" }))
|
||||
hl.dispatch(hl.dsp.window.resize({ x = width, y = height }))
|
||||
hl.dispatch(hl.dsp.window.center())
|
||||
hl.dispatch(hl.dsp.window.pin())
|
||||
hl.dispatch(hl.dsp.window.alter_zorder({ mode = "top" }))
|
||||
hl.dispatch(hl.dsp.window.tag({ tag = "+pop" }))
|
||||
end
|
||||
end, "Pop window out (float & pin)")
|
||||
bind("SUPER + CTRL + L", function()
|
||||
local layouts = { "dwindle", "scrolling", "monocle", "master" }
|
||||
local workspace = hl.get_active_workspace()
|
||||
if hl.get_active_special_workspace() then
|
||||
workspace = hl.get_active_special_workspace()
|
||||
end
|
||||
|
||||
local next_layout = "dwindle"
|
||||
|
||||
if not workspace then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, #layouts do
|
||||
if layouts[i] == workspace.tiled_layout then
|
||||
local next_layout_idx = (i % #layouts) + 1
|
||||
next_layout = layouts[next_layout_idx]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if workspace.special then
|
||||
hl.workspace_rule({ workspace = tostring(workspace.name), layout = next_layout })
|
||||
else
|
||||
hl.workspace_rule({ workspace = tostring(workspace.id), layout = next_layout })
|
||||
end
|
||||
|
||||
notify(" Workspace layout set to " .. next_layout)
|
||||
end, "Toggle workspace layout")
|
||||
|
||||
-- Move focus with SUPER + arrow keys
|
||||
bind("SUPER + H", hl.dsp.focus({ direction = "left" }), "Move window focus left")
|
||||
@@ -153,12 +202,26 @@ bind(
|
||||
exec("hyprctl dispatch setprop \"address:$(hyprctl activewindow -j | jq -r '.address')\" opaque toggle"),
|
||||
"Toggle window transparency"
|
||||
)
|
||||
bind("SUPER + SHIFT + BACKSPACE", exec("station-hyprland-window-gaps-toggle"), "Toggle window gaps")
|
||||
bind(
|
||||
"SUPER + CTRL + Backspace",
|
||||
exec("station-hyprland-window-single-square-aspect-toggle"),
|
||||
"Toggle single-window square aspect"
|
||||
)
|
||||
bind("SUPER + SHIFT + BACKSPACE", function()
|
||||
local gaps = hl.get_config("general.gaps_out")
|
||||
if gaps.top == 0 then
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_out = 10,
|
||||
gaps_in = 5,
|
||||
border_size = 2,
|
||||
},
|
||||
})
|
||||
else
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_out = 0,
|
||||
gaps_in = 0,
|
||||
border_size = 0,
|
||||
},
|
||||
})
|
||||
end
|
||||
end, "Toggle window gaps")
|
||||
|
||||
-- Notifications
|
||||
bind("SUPER + COMMA", exec("makoctl dismiss"), "Dismiss last notification")
|
||||
@@ -180,17 +243,16 @@ bind("SUPER + PRINT", exec("pkill hyprpicker || hyprpicker -a"), "Color picker")
|
||||
-- bind("SUPER CTRL + S", exec("station-menu share"), "Share")
|
||||
|
||||
-- Waybar-less information
|
||||
bind("SUPER + CTRL + ALT + T", exec('notify-send " $(date +"%A %H:%M — %d %B W%V %Y")"'), "Show time")
|
||||
bind("SUPER + CTRL + ALT + T", exec('notify " $(date +"%A %H:%M — %d %B W%V %Y")"'), "Show time")
|
||||
bind(
|
||||
"SUPER + CTRL + ALT + B",
|
||||
exec('notify-send " Battery is at $(station-battery-remaining)%"'),
|
||||
"Show battery remaining"
|
||||
)
|
||||
bind(
|
||||
"SUPER + CTRL + ALT + W",
|
||||
exec('notify-send "$(hyprctl activewindow -j | jq -r \'"Window: (.title)\nClass: (.class)"\')"'),
|
||||
"Show active window name and class"
|
||||
)
|
||||
bind("SUPER + CTRL + ALT + W", function()
|
||||
local window = hl.get_active_window()
|
||||
notify("Window: " .. window.title .. "\nClass: " .. window.class)
|
||||
end, "Show active window name and class")
|
||||
|
||||
-- Control panels
|
||||
bind("SUPER + CTRL + A", exec("station-launch-audio"), "Audio controls")
|
||||
|
||||
Reference in New Issue
Block a user