You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

127 lines
4.8 KiB

local main_mod = MainMod or 'SUPER'
local task_e = TaskE or ''
local utils = require('land.utils')
local dropdown = require('land.tools.dropdown')
-------------
-- Hyprland
-------------
--
-- base
--
hl.bind(main_mod .. ' + H', hl.dsp.focus { direction = 'l' })
--hl.bind(main_mod .. ' + J', hl.dsp.focus { monitor = 'd' })
hl.bind(main_mod .. ' + J', utils.layout_bind {
scrolling = hl.dsp.focus { monitor = 'd' },
default = hl.dsp.focus { direction = 'd' },
})
hl.bind(main_mod .. ' + K', utils.layout_bind {
scrolling = hl.dsp.focus { monitor = 'u' },
default = hl.dsp.focus { direction = 'u' },
})
--hl.bind(main_mod .. ' + K', hl.dsp.focus { monitor = 'u' })
hl.bind(main_mod .. ' + L', hl.dsp.focus { direction = 'r' })
hl.bind(main_mod .. ' + TAB', hl.dsp.focus { monitor = '+1' })
hl.bind(main_mod .. ' + comma', hl.dsp.focus { workspace = 'm-1' })
hl.bind(main_mod .. ' + period', hl.dsp.focus { workspace = 'm+1' })
for i = 1, 9 do
hl.bind(main_mod .. ' + CTRL + ' .. i, hl.dsp.dpms { action = 'toggle', monitor = 'DP-' .. i }) -- toggle monitors on/off(not physically, as in idle-screensaver.)
end
-- same action when DP-n isn't existed
--hl.bind(main_mod .. ' + CTRL + 0', function ()
-- hl.dispatch(hl.dsp.dpms {action = 'toggle', monitor = 'DP-1' })
-- hl.dispatch(hl.dsp.dpms {action = 'toggle', monitor = 'DP-4' })
--end)
hl.bind(main_mod .. ' + SHIFT + E', hl.dsp.exec_raw('tofi-power --height=240'))
--
-- window
--
hl.bind(main_mod .. ' + Q', hl.dsp.window.close())
hl.bind(main_mod .. ' + SHIFT + Q', hl.dsp.window.kill())
hl.bind(main_mod .. ' + F', hl.dsp.window.fullscreen { mode = 'maximized', action = 'toggle' })
hl.bind(main_mod .. ' + SHIFT + F', hl.dsp.window.fullscreen { mode = 'fullscreen', action = 'toggle' })
hl.bind(main_mod .. ' + ALT + P', hl.dsp.window.float { action = 'toggle' })
hl.bind(main_mod .. ' + mouse:272', hl.dsp.window.drag(), { mouse = true })
hl.bind(main_mod .. ' + mouse:273', hl.dsp.window.resize(), { mouse = true })
hl.bind(main_mod .. ' + SHIFT + mouse:273', hl.dsp.window.resize { keep_aspect_ratio = true }, { mouse = true })
--hl.bind(main_mod .. ' + SHIFT + H', hl.dsp.window.swap { direction = 'l' })
hl.bind(main_mod .. ' + SHIFT + J', hl.dsp.window.move { monitor = 'd' })
hl.bind(main_mod .. ' + SHIFT + K', hl.dsp.window.move { monitor = 'u' })
--hl.bind(main_mod .. ' + SHIFT + L', hl.dsp.window.swap { direction = 'r' })
hl.bind(main_mod .. ' + SHIFT + H', hl.dsp.layout('swapcol l'))
hl.bind(main_mod .. ' + SHIFT + L', hl.dsp.layout('swapcol r'))
hl.bind(main_mod .. ' + S', hl.dsp.window.toggle_swallow())
hl.bind(main_mod .. ' + P', hl.dsp.window.pin { action = 'toggle' })
for w = 1, 10 do
local k = w % 10
hl.bind(main_mod .. ' + ' .. k, hl.dsp.focus { workspace = w, on_current_monitor = false })
hl.bind(main_mod .. ' + SHIFT + ' .. k, hl.dsp.window.move { workspace = w })
end
--
-- workspace
--
hl.bind(main_mod .. ' + N', hl.dsp.workspace.toggle_special())
hl.bind(main_mod .. ' + M', hl.dsp.window.move { workspace = 'special' })
--
-- group
--
--
-- cursor
--
-----------
-- Layout
-----------
hl.bind(main_mod .. ' + minus', hl.dsp.layout('colresize -conf'))
hl.bind(main_mod .. ' + equal', hl.dsp.layout('colresize +conf'))
---------
-- Apps
---------
-- launcher
local cmd_kill_drun='pkill tofi-drun'
local cmd_drun='tofi-drun --drun-launch=true --fuzzy-match=true'
hl.bind(main_mod .. ' + SUPER_L', hl.dsp.exec_raw(cmd_kill_drun .. ' || ' .. task_e .. cmd_drun), { release = true })
hl.bind(main_mod .. ' + SPACE', hl.dsp.exec_raw(cmd_kill_drun .. ' || ' .. cmd_drun))
-- volume
hl.bind('XF86AudioLowerVolume', hl.dsp.exec_raw('wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%-'), { repeating = true })
hl.bind('XF86AudioRaiseVolume', hl.dsp.exec_raw('wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 1%+'), { repeating = true })
-- player
hl.bind(main_mod .. ' + bracketleft', hl.dsp.exec_raw('playerctl previous'))
hl.bind(main_mod .. ' + bracketright', hl.dsp.exec_raw('playerctl next'))
hl.bind(main_mod .. ' + SHIFT + bracketleft', hl.dsp.exec_raw('playerctl position 5-'), { repeating = true })
hl.bind(main_mod .. ' + SHIFT + bracketright', hl.dsp.exec_raw('playerctl position 5+'), { repeating = true })
-- screenshot
hl.bind('Print', hl.plugin.hyprcapture.open)
-- waybar
hl.bind(main_mod .. ' + T', hl.dsp.exec_raw('killall waybar || waybar'))
-- terminal
hl.bind(main_mod .. ' + Return', hl.dsp.exec_raw(task_e .. 'kitty'))
hl.bind(main_mod .. ' + SHIFT + Return', hl.dsp.exec_cmd(task_e .. 'kitty', { float = true, center = true, size = {1200, 800} }))
hl.bind(main_mod .. ' + F9', dropdown.dsp.toggle(task_e .. 'kitty --class kitty-musicfox musicfox'))
-- browser
hl.bind(main_mod .. ' + SHIFT + B', hl.dsp.exec_cmd('chromany', { workspace = 3 }))
hl.bind(main_mod .. ' + B', hl.dsp.exec_cmd('dex /var/lib/flatpak/exports/share/applications/app.zen_browser.zen.desktop', { workspace = 3 }))