added help script for keybindings to xmonad

This commit is contained in:
Solomon Laing 2021-08-18 17:51:36 +09:30
parent f9aecde965
commit 0deec97ced
5 changed files with 138 additions and 133 deletions

5
.local/bin/plexamp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
if [ -f /usr/bin/Plexamp.AppImage ]; then
/usr/bin/Plexamp.AppImage
fi

0
.local/bin/server-setup-commands Normal file → Executable file
View File

12
.local/bin/xmonad-keys Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
sed -n '/--START_KEYS/,/--END_KEYS/p' $HOME/.xmonad/xmonad.hs | \
grep -e ', ("' \
-e '\[ ("' \
-e '--NOTE' | \
grep -v '\-\- , ' |\
sed -e 's/^[ \t,]*//' \
-e 's/\[ (/(/' \
-e 's/--NOTE /\n/' \
-e 's/, / --> /' | \
yad --text-info --back=#121e32 --fore=#dfdfef --geometry=1200x800

View File

@ -32,7 +32,7 @@ import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, s
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks (docks, avoidStruts, docksEventHook, manageDocks, ToggleStruts(..))
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat)
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat)
import XMonad.Hooks.EwmhDesktops (ewmh, fullscreenEventHook)
import XMonad.Hooks.ServerMode
import XMonad.Hooks.SetWMName
@ -150,134 +150,96 @@ clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
myEZKeys :: [(String, X ())]
myEZKeys =
-- xmonad
[ ("M-'", spawn "xmonad --recompile; xmonad --restart")
--START_KEYS
--NOTE xmonad
[ ("M-'", spawn "xmonad --recompile; xmonad --restart") -- restart xmonad
-- open my terminal
, ("M-S-<Return>", spawn (myTerminal))
--NOTE launchers
, ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26") -- open dmenu
, ("M-o", spawn "rofi -show run") -- open rofi
-- run launchers
, ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26")
, ("M-o", spawn "rofi -show run")
--NOTE keybound programs
, ("M-S-<Return>", spawn (myTerminal)) -- open a terminal
, ("M-l", spawn (myFileManager)) -- open a file manager
-- keybound programs
, ("M-l", spawn (myFileManager))
--NOTE wm controls
, ("M-S-j", kill1) -- kill focused windown
, ("M-<Space>", sendMessage NextLayout) -- rotate through layouts
-- , ("M-S-<space>", setLayout $ Xmonad.layoutHook conf) -- reset layout to default
, ("M-S-y", refresh) -- reset current window to correct size
, ("M-<Tab>", windows W.focusDown) -- focus next window
, ("M-S-<Tab>", windows W.focusUp) -- focus previous window
, ("M-m", windows W.focusMaster) -- focus master window
, ("M-<Return>", windows W.swapMaster) -- swap window with master
, ("M-S-<Up>", windows W.swapDown) -- swap window with next window
, ("M-S-<Down>", windows W.swapUp) -- swap window with previous window
, ("M-<Left>", sendMessage Shrink) -- shrink master area
, ("M-<Right>", sendMessage Expand) -- grow master area
, ("M-<Down>", sendMessage MirrorShrink) -- shrink master area
, ("M-<Up>", sendMessage MirrorExpand) -- grow master area
, ("M-y", withFocused $ windows . W.sink) -- push floating window back into tiling
, ("M-w", sendMessage (IncMasterN 1)) -- increment windows in master
, ("M-v", sendMessage (IncMasterN (-1))) -- decrement windows in master
, ("M-b", sendMessage ToggleStruts) -- toggle bar
-- wm controls
-- kill focused windown
, ("M-S-j", kill1)
-- rotate through layouts
, ("M-<Space>", sendMessage NextLayout)
-- reset layout to default
-- , ("M-S-<space>", setLayout $ Xmonad.layoutHook conf)
-- reset current window to correct size
, ("M-S-y", refresh)
-- focus next window
, ("M-<Tab>", windows W.focusDown)
-- focus previous window
, ("M-S-<Tab>", windows W.focusUp)
-- focus master window
, ("M-m", windows W.focusMaster)
-- swap window with master
, ("M-<Return>", windows W.swapMaster)
-- swap window with next window
, ("M-S-<Up>", windows W.swapDown)
-- swap window with previous window
, ("M-S-<Down>", windows W.swapUp)
-- shrink master area
, ("M-<Left>", sendMessage Shrink)
-- grow master area
, ("M-<Right>", sendMessage Expand)
-- shrink master area
, ("M-<Down>", sendMessage MirrorShrink)
-- grow master area
, ("M-<Up>", sendMessage MirrorExpand)
-- push floating window back into tiling
, ("M-y", withFocused $ windows . W.sink)
-- increment windows in master
, ("M-w", sendMessage (IncMasterN 1))
-- decrement windows in master
, ("M-v", sendMessage (IncMasterN (-1)))
-- toggle bar
, ("M-b", sendMessage ToggleStruts)
-- show keybinds
-- , ("M-S-z", spawn "spawn ("echo \"" ++ help ++ "\" | xmessage -file -")
--NOTE my custom keybind/script combinations
--NOTE system controls
, ("M-S-s", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"") -- prompt computer shutdown
, ("M-S-r", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"") -- prompt computer restart
, ("M-<Escape>", spawn "$HOME/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1") -- prompt computer lock
-- My custom keybind/script combinations
-- prompt computer shutdown
, ("M-S-s", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"")
-- prompt computer restart
, ("M-S-r", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"")
-- prompt computer lock
, ("M-<Escape>", spawn "$HOME/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1")
--NOTE bitwarden controls
, ("M-S-x", spawn "$HOME/.local/bin/bw-unlock") -- unlock bitwarden cli
, ("M-x", spawn "$HOME/.local/bin/passwords") -- get password from bw cli
--NOTE demenu search
, ("M-s s", spawn "$HOME/.local/bin/dmenusearch") -- launch searcher (dmenu and surf)
, ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo") -- launch searcher, default to duckduckgo
-- unlock bitwarden cli
, ("M-S-x", spawn "$HOME/.local/bin/bw-unlock")
-- get password from bw cli
, ("M-x", spawn "$HOME/.local/bin/passwords")
--NOTE drive mounting
, ("M-d m", spawn "$HOME/.local/bin/dmenumount") -- launch mounter
, ("M-d u", spawn "$HOME/.local/bin/dmenuumount") -- launch unmounter
-- launch searcher (dmenu and surf)
, ("M-s s", spawn "$HOME/.local/bin/dmenusearch")
-- launch searcher, default to duckduckgo
, ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo")
--NOTE backlight controls
, ("<XF86MonBrightnessUp>", spawn "$HOME/.local/bin/mod_backlight +10") -- increase backlight brightness by 10
, ("<XF86MonBrightnessDown>", spawn "$HOME/.local/bin/mod_backlight -10") -- decrease backlight brightness by 10
-- launch mounter
, ("M-d m", spawn "$HOME/.local/bin/dmenumount")
-- launch unmounter
, ("M-d u", spawn "$HOME/.local/bin/dmenuumount")
--NOTE music and audio controls
, ("M-S-o", spawn "$HOME/.local/bin/set-default-sink") -- set default output
, ("M-S-i", spawn "$HOME/.local/bin/set-default-source") -- set default input
, ("<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-sink-volume") -- decrease output volume
, ("<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-sink-volume") -- increase output volume
, ("<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-sink-mute") -- toggle output mute
, ("S-<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-source-volume") -- decrease input volume
, ("S-<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-source-volume") -- increase input volume
, ("S-<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-source-mute") -- toggle input mute
-- backlight controls
-- increase backlight brightness by 10
, ("<XF86MonBrightnessUp>", spawn "$HOME/.local/bin/mod_backlight +10")
-- decrease backlight brightness by 10
, ("<XF86MonBrightnessDown>", spawn "$HOME/.local/bin/mod_backlight -10")
-- music and audio controls
-- decrease output volume
, ("<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-sink-volume")
-- increase output volume
, ("<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-sink-volume")
-- toggle output mute
, ("<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-sink-mute")
-- decrease input volume
, ("S-<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-source-volume")
-- increase input volume
, ("S-<XF86AudioRaiseVolume>", spawn "$HOME/.local/bin/inc-source-volume")
-- toggle input mute
, ("S-<XF86AudioMute>", spawn "$HOME/.local/bin/toggle-source-mute")
-- set default output
, ("M-S-o", spawn "$HOME/.local/bin/set-default-sink")
-- set default input
, ("M-S-i", spawn "$HOME/.local/bin/set-default-source")
-- extras
, ("<Print>", spawn "flameshot gui")
--NOTE extras
, ("M-S-/", spawn "$HOME/.local/bin/xmonad-keys") -- show keybinds
, ("<Print>", spawn "scrot") -- take full (all monitors) screenshot
, ("M-<Print>", spawn "flameshot gui") -- launch flameshot for snipping
]
myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
-- Mouse bindings: default actions bound to mouse events
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
-- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
-- mod-button2, Raise the window to the top of the stack
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
-- mod-button2, Raise the window to the top of the stack, push to master.
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-- mod-button3, Set the window to floating mode and resize by dragging
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
-- you may also bind events to the mouse scroll wheel (button4 and button5)
]
--END_KEYS
------------------------------------------------------------------------
-- Layouts:
@ -384,8 +346,9 @@ myManageHook = composeAll
, className =? "guake" --> doIgnore
, className =? "barrier" --> doFloat
, className =? "net-runelite-client-RuneLite" --> doFloat
, className =? "Yad" --> doCenterFloat
, className =? "net-runelite-launcher-Launcher" --> doIgnore
, className =? "steam_app_221380" --> doIgnore
, className =? "steam_app_221380" --> doIgnore
, resource =? "desktop_window" --> doIgnore
, (className =? "firefox" <&&> resource =? "Dialog")--> doFloat -- Float Firefox Dialog
, resource =? "kdesktop" --> doIgnore
@ -436,6 +399,7 @@ myStartupHook = do
spawnOnce "slack &"
spawnOnce "todoist &"
spawnOnce "element-desktop --hidden &"
spawnOnce "flameshot"
-- Start trayer last
spawnOnce "trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 --tint 0x121e32 --height 20 &"
@ -502,53 +466,75 @@ main = do
-- | Finally, a copy of the default bindings in simple textual tabular format.
help :: String
help = unlines ["The default modifier key is 'alt'. Default keybindings:",
help = unlines ["The default modifier key is 'super'. Default keybindings:",
"",
"-- launching and killing programs",
"mod-Shift-Enter Launch terminal",
"mod-a Launch run menu",
"mod-Shift-a Launch ssh menu",
"mod-o Launch dmenu",
"mod-l Launch file manager",
"mod-a Launch dmenu",
"mod-o Launch rofi",
"mod-Shift-j Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size",
"",
"-- Keybound programs",
"mod-Shift-x Unlock bitwarden cli",
"mod-x Password prompt",
"mod-l Launch file manager",
"",
"-- Misc scripts",
"mod-s s Dmenu search script",
"mod-s d Dmenu search script, default duckduckgo",
"mod-d m Dmenu mount script",
"mod-d u Dmenu unmount script",
"",
"-- Media control",
"mod-Shift-o Select output device",
"mod-Shift-i Select input device",
"The rest use standard media keys.",
"",
"-- Backlight controls",
"Uses standard system keys",
"",
"-- system control",
"mod-Shift-s Shutdown prompt, default no",
"mod-Shift-r Restart prompt, default no",
"mod-Escape Lock prompt, default yes",
"<Print> Take full (all monitors) screenshot",
"mod-<Print> Open flameshot gui for better snipping",
"",
"-- move focus up or down the window stack",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-h Move focus to the next window",
"mod-t Move focus to the previous window",
"mod-m Move focus to the master window",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-m Move focus to the master window",
"",
"-- modifying the window order",
"mod-Return Swap the focused window and the master window",
"mod-Shift-h Swap the focused window with the next window",
"mod-Shift-t Swap the focused window with the previous window",
"mod-Return Swap the focused window and the master window",
"mod-Shift-Up Swap the focused window with the next window",
"mod-Shift-Down Swap the focused window with the previous window",
"",
"-- resizing the master/slave ratio",
"mod-d Shri sk the master area",
"mod-n Expand the master area",
"mod-Left Shrink the master area (horizontally)",
"mod-Right Expand the master area",
"mod-Up Mirror shrink master area (vertically)",
"mod-Down Mirror grow master area",
"",
"-- floating layer support",
"mod-y Push window back into tiling; unfloat and re-tile it",
"mod-y Push window back into tiling; unfloat and re-tile it",
"mod-b Toggle whether the bar shows or not",
"",
"-- increase or decrease number of windows in the master area",
"mod-w (mod-,) Increment the number of windows in the master area",
"mod-vL (mod-.) Deincrement the number of windows in the master area",
"mod-w Increment the number of windows in the master area",
"mod-v Deincrement the number of windows in the master area",
"",
"-- quit, or restart",
"mod-Shift-' Quit xmonad",
"mod-' Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"-- restarting Xmonad",
"mod-' Restart xmonad",
"",
"-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N",
"mod-{',','.','p'} Switch to physical/Xinerama screens 1, 2, or 3",
"mod-Shift-{',','.','p'} Move client to screen 1, 2, or 3",
"mod-[1..9] Switch to workSpace N",
"mod-Shift-[1..9] Move client to workspace N",
"",
"-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"]
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack (switch push to master and cascade)",
"mod-button3 Set the window to floating mode and resize by dragging"]

View File

@ -1,5 +1,7 @@
git-flow-completion-git
yad
scrot
pulseaudio-bluetooth
bluez-utils
sshfs