Refactoring
This commit is contained in:
@@ -1,34 +1,10 @@
|
||||
require 'helpers'
|
||||
-- ==========================
|
||||
-- Media
|
||||
-- ==========================
|
||||
-- Only display the OSD on the currently focused monitor
|
||||
local osdclient = 'swayosd-client --monitor "$(hyprctl monitors -j | jq -r \'.[] | select(.focused == true).name\')"'
|
||||
|
||||
local exec = hl.dsp.exec_cmd
|
||||
local shortcut = hl.dsp.send_shortcut
|
||||
|
||||
local function bind(key, cmd, desc, opts)
|
||||
opts = opts or {}
|
||||
opts.desc = desc
|
||||
hl.bind(key, cmd, opts)
|
||||
end
|
||||
|
||||
local function bindl(key, cmd, desc, opts)
|
||||
opts = opts or {}
|
||||
opts.locked = true
|
||||
bind(key, cmd, desc, opts)
|
||||
end
|
||||
|
||||
local function bindlr(key, cmd, desc, opts)
|
||||
opts = opts or {}
|
||||
opts.repeating = true
|
||||
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')
|
||||
@@ -118,18 +94,6 @@ bind('SUPER + CTRL + L', function()
|
||||
notify(' Workspace layout set to ' .. next_layout)
|
||||
end, 'Toggle workspace layout')
|
||||
|
||||
local get_current_layout = function()
|
||||
local workspace = hl.get_active_workspace()
|
||||
if hl.get_active_special_workspace() then
|
||||
workspace = hl.get_active_special_workspace()
|
||||
end
|
||||
if not workspace then
|
||||
return 'dwindle'
|
||||
end
|
||||
|
||||
return workspace.tiled_layout
|
||||
end
|
||||
|
||||
-- Move focus with SUPER + arrow keys
|
||||
bind('SUPER + H', function()
|
||||
if get_current_layout() == 'monocle' then
|
||||
|
||||
Reference in New Issue
Block a user