Update keybindings
parent
bac32dfe10
commit
b60c8514b7
|
@ -158,65 +158,106 @@ myConfig =
|
||||||
layoutHook = avoidStruts myLayoutHook,
|
layoutHook = avoidStruts myLayoutHook,
|
||||||
handleEventHook = dynamicPropertyChange "WM_NAME" myDynamicManageHook <> handleEventHook def <> Hacks.windowedFullscreenFixEventHook
|
handleEventHook = dynamicPropertyChange "WM_NAME" myDynamicManageHook <> handleEventHook def <> Hacks.windowedFullscreenFixEventHook
|
||||||
}
|
}
|
||||||
`removeKeysP` myRemoveKeysP
|
`removeKeysP` myRemoveKeys
|
||||||
`additionalKeysP` myKeysP
|
`additionalKeysP` myKeys
|
||||||
|
`additionalMouseBindings` myMouseBindings
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Keybindings {{{
|
-- Keybindings {{{
|
||||||
|
|
||||||
-- Keybindings to be added/overridden
|
-- Keybindings to be added/overridden
|
||||||
myKeysP =
|
myKeys :: [(String, X ())]
|
||||||
[ -- Fit floating windows back to layout
|
myKeys =
|
||||||
("M-S-<Space>", withFocused $ windows . W.sink),
|
[ ("M-<Space> s", unfloatFocusedW),
|
||||||
-- Launchers
|
("M-<Space> <Space>", nextLayout), -- Cycle through layouts
|
||||||
("M-S-p", spawn "alacritty --class Launcher,Launcher"),
|
("M-<Space> S-<Space>", defaultLayout), --
|
||||||
("<F8>", spawn "keepassxc"),
|
("M-<Space> M-<Space>", nextLayout), -- ..fat finger
|
||||||
("M-p", spawn "albert toggle"),
|
("M-<Space> M-S-<Space>", defaultLayout), --
|
||||||
-- Map insert key to paste from clipboard
|
("M-S-p", spawnTermLauncher),
|
||||||
|
("<F8>", spawnKeepassXC),
|
||||||
|
("M-z", spawnZettelkasten),
|
||||||
|
("M-p", spawnLauncher),
|
||||||
("<Insert>", pasteSelection),
|
("<Insert>", pasteSelection),
|
||||||
-- Map print screen to take a screenshot with flameshot
|
("<Print>", printScreen),
|
||||||
("<Print>", spawn "flameshot gui"),
|
("<XF86AudioRaiseVolume>", raiseVol), -- Audio volume & playback
|
||||||
-- Map audio keys to control volume
|
("<XF86AudioLowerVolume>", lowerVol), --
|
||||||
("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"),
|
("<XF86AudioMute>", mute), --
|
||||||
("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"),
|
("M-<Right>", nextTrack), --
|
||||||
("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"),
|
("M-<Left>", prevTrack), --
|
||||||
-- Map brightness keys to control brightness with brightnessctl
|
("M-<Up>", play), --
|
||||||
("<XF86MonBrightnessUp>", spawn "brightnessctl set 20+"),
|
("M-<Down>", pause), --
|
||||||
("<XF86MonBrightnessDown>", spawn "brightnessctl set 20-"),
|
("<XF86MonBrightnessUp>", brighten), -- Brightness & hue controls
|
||||||
-- Map brightness keys + shift to adjust redshift temperature
|
("<XF86MonBrightnessDown>", dim), --
|
||||||
("S-<XF86MonBrightnessUp>", spawn "echo $(($(cat /tmp/temperature) + 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"),
|
("S-<XF86MonBrightnessUp>", warm), --
|
||||||
("S-<XF86MonBrightnessDown>", spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"),
|
("S-<XF86MonBrightnessDown>", cool), --
|
||||||
-- Reset redshift temperature
|
("M-S-<XF86MonBrightnessUp>", resetTemp), --
|
||||||
("M-S-<XF86MonBrightnessUp>", spawn "echo 3000 > /tmp/temperature && redshift -x"),
|
("M-S-<XF86MonBrightnessDown>", resetTemp), --
|
||||||
("M-S-<XF86MonBrightnessDown>", spawn "echo 3000 > /tmp/temperature && redshift -x"),
|
("M-S-b", fullscreenBrowser),
|
||||||
-- Use power down key to suspend
|
("<XF86Calculator>", spawnCalculator),
|
||||||
("<XF86PowerOff>", spawn "systemctl suspend"),
|
("<XF86PowerOff>", spawn "systemctl suspend") --TODO: Only enable this on laptop
|
||||||
-- FIXME: Spawn firefox in fullscreen, but not in kiosk mode
|
] ++
|
||||||
("M-S-b", spawn "firefox --fullscreen"),
|
[ (m ++ k, windows $ f w) |
|
||||||
-- Magnify window using arrow keys
|
(m, f) <- zip ["M-", "M-S-"]
|
||||||
("M-=", sendMessage MagnifyMore >> sendMessage Mag.ToggleOn),
|
[W.greedyView, W.shift],
|
||||||
("M--", sendMessage MagnifyLess >> sendMessage Mag.ToggleOn),
|
(k, w) <- zip myWorkspaceKeys
|
||||||
-- Reset magnification
|
(withScreen 0 myWorkspaces)
|
||||||
("M-S-=", sendMessage Mag.ToggleOff),
|
++ zip mySharedWorkspaceKeys
|
||||||
("<XF86Calculator>", spawn "alacritty --class 'Calculator' -e ipython -i /home/h/.bin/calc.py"),
|
(withScreen 1 mySharedWorkspaces)
|
||||||
-- playerctl ncspot using arrow keys
|
|
||||||
("M-<Right>", spawn "playerctl next"),
|
|
||||||
("M-<Left>", spawn "playerctl previous"),
|
|
||||||
("M-<Up>", spawn "playerctl play"),
|
|
||||||
("M-<Down>", spawn "playerctl pause")
|
|
||||||
] ++ [
|
|
||||||
(m ++ k, windows $ f w) |
|
|
||||||
(m, f) <- zip ["M-", "M-S-"]
|
|
||||||
[W.greedyView, W.shift],
|
|
||||||
(k, w) <- zip myWorkspaceKeys (withScreen 0 myWorkspaces) ++ zip mySharedWorkspaceKeys (withScreen 1 mySharedWorkspaces)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
zipKeyPrefixes :: [String] -> [String] -> [String]
|
zipKeyPrefixes :: [String] -> [String] -> [String]
|
||||||
zipKeyPrefixes prefixes keys = [prefix ++ key | prefix <- prefixes, key <- keys]
|
zipKeyPrefixes prefixes keys = [prefix ++ key | prefix <- prefixes, key <- keys]
|
||||||
|
|
||||||
-- Keybindings to be removed
|
-- Keybindings to be removed
|
||||||
myRemoveKeysP = "M-S-q" : zipKeyPrefixes ["M-", "M-S-"] (map show [ 1..5 ])
|
myRemoveKeys :: [String]
|
||||||
|
myRemoveKeys = "M-S-q" : zipKeyPrefixes ["M-", "M-S-"] (map show [ 1..5 ])
|
||||||
|
|
||||||
|
myMouseBindings = []
|
||||||
|
|
||||||
|
unfloatFocusedW :: X ()
|
||||||
|
unfloatFocusedW = withFocused $ windows . W.sink
|
||||||
|
|
||||||
|
myStartupHook :: X ()
|
||||||
|
nextLayout = sendMessage NextLayout
|
||||||
|
|
||||||
|
defaultLayout :: X ()
|
||||||
|
defaultLayout = setLayout $ Layout myLayoutHook
|
||||||
|
|
||||||
|
spawnZettelkasten :: X ()
|
||||||
|
spawnZettelkasten = spawn "alacritty --class Zettelkasten,Zettelkasten -e nvim $(cat ~/.zk/current-zettel.txt)"
|
||||||
|
|
||||||
|
spawnKeepassXC :: X ()
|
||||||
|
spawnKeepassXC = spawn "keepassxc"
|
||||||
|
|
||||||
|
fullscreenBrowser :: X ()
|
||||||
|
fullscreenBrowser = spawn "firefox --fullscreen"
|
||||||
|
|
||||||
|
spawnLauncher, spawnTermLauncher :: X ()
|
||||||
|
spawnLauncher = spawn "albert toggle"
|
||||||
|
spawnTermLauncher = spawn "alacritty --class Launcher,Launcher"
|
||||||
|
spawnCalculator = spawn "alacritty --class 'Calculator' -e ipython -i /home/h/.bin/calc.py"
|
||||||
|
|
||||||
|
printScreen :: X ()
|
||||||
|
printScreen = spawn "flameshot gui"
|
||||||
|
|
||||||
|
raiseVol, lowerVol, mute :: X ()
|
||||||
|
raiseVol = spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"
|
||||||
|
lowerVol = spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"
|
||||||
|
mute = spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
||||||
|
|
||||||
|
nextTrack, prevTrack, play, pause :: X ()
|
||||||
|
nextTrack = spawn "playerctl next"
|
||||||
|
prevTrack = spawn "playerctl previous"
|
||||||
|
play = spawn "playerctl play"
|
||||||
|
pause = spawn "playerctl pause"
|
||||||
|
|
||||||
|
brighten, dim, warm, cool, resetTemp :: X ()
|
||||||
|
brighten = spawn "brightnessctl set 20+"
|
||||||
|
dim = spawn "brightnessctl set 20-"
|
||||||
|
warm = spawn "echo $(($(cat /tmp/temperature) + 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"
|
||||||
|
cool = spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"
|
||||||
|
resetTemp = spawn "echo 3000 > /tmp/temperature && redshift -x"
|
||||||
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue