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.FadeInactive
import XMonad.Hooks.ManageDocks (docks, avoidStruts, docksEventHook, manageDocks, ToggleStruts(..)) 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.EwmhDesktops (ewmh, fullscreenEventHook)
import XMonad.Hooks.ServerMode import XMonad.Hooks.ServerMode
import XMonad.Hooks.SetWMName import XMonad.Hooks.SetWMName
@ -150,134 +150,96 @@ clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
myEZKeys :: [(String, X ())] myEZKeys :: [(String, X ())]
myEZKeys = myEZKeys =
-- xmonad --START_KEYS
[ ("M-'", spawn "xmonad --recompile; xmonad --restart") --NOTE xmonad
[ ("M-'", spawn "xmonad --recompile; xmonad --restart") -- restart xmonad
-- open my terminal --NOTE launchers
, ("M-S-<Return>", spawn (myTerminal)) , ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26") -- open dmenu
, ("M-o", spawn "rofi -show run") -- open rofi
-- run launchers --NOTE keybound programs
, ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26") , ("M-S-<Return>", spawn (myTerminal)) -- open a terminal
, ("M-o", spawn "rofi -show run") , ("M-l", spawn (myFileManager)) -- open a file manager
-- keybound programs --NOTE wm controls
, ("M-l", spawn (myFileManager)) , ("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 --NOTE my custom keybind/script combinations
-- kill focused windown --NOTE system controls
, ("M-S-j", kill1) , ("M-S-s", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"") -- prompt computer shutdown
-- rotate through layouts , ("M-S-r", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"") -- prompt computer restart
, ("M-<Space>", sendMessage NextLayout) , ("M-<Escape>", spawn "$HOME/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1") -- prompt computer lock
-- 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 -")
-- My custom keybind/script combinations --NOTE bitwarden controls
-- prompt computer shutdown , ("M-S-x", spawn "$HOME/.local/bin/bw-unlock") -- unlock bitwarden cli
, ("M-S-s", spawn "$HOME/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"") , ("M-x", spawn "$HOME/.local/bin/passwords") -- get password from bw cli
-- 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")
-- unlock bitwarden cli --NOTE demenu search
, ("M-S-x", spawn "$HOME/.local/bin/bw-unlock") , ("M-s s", spawn "$HOME/.local/bin/dmenusearch") -- launch searcher (dmenu and surf)
-- get password from bw cli , ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo") -- launch searcher, default to duckduckgo
, ("M-x", spawn "$HOME/.local/bin/passwords")
-- launch searcher (dmenu and surf) --NOTE drive mounting
, ("M-s s", spawn "$HOME/.local/bin/dmenusearch") , ("M-d m", spawn "$HOME/.local/bin/dmenumount") -- launch mounter
-- launch searcher, default to duckduckgo , ("M-d u", spawn "$HOME/.local/bin/dmenuumount") -- launch unmounter
, ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo")
-- launch mounter --NOTE backlight controls
, ("M-d m", spawn "$HOME/.local/bin/dmenumount") , ("<XF86MonBrightnessUp>", spawn "$HOME/.local/bin/mod_backlight +10") -- increase backlight brightness by 10
-- launch unmounter , ("<XF86MonBrightnessDown>", spawn "$HOME/.local/bin/mod_backlight -10") -- decrease backlight brightness by 10
, ("M-d u", spawn "$HOME/.local/bin/dmenuumount")
-- backlight controls --NOTE music and audio controls
-- increase backlight brightness by 10 , ("M-S-o", spawn "$HOME/.local/bin/set-default-sink") -- set default output
, ("<XF86MonBrightnessUp>", spawn "$HOME/.local/bin/mod_backlight +10") , ("M-S-i", spawn "$HOME/.local/bin/set-default-source") -- set default input
-- decrease backlight brightness by 10 , ("<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-sink-volume") -- decrease output volume
, ("<XF86MonBrightnessDown>", spawn "$HOME/.local/bin/mod_backlight -10") , ("<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
-- music and audio controls --NOTE extras
-- decrease output volume , ("M-S-/", spawn "$HOME/.local/bin/xmonad-keys") -- show keybinds
, ("<XF86AudioLowerVolume>", spawn "$HOME/.local/bin/dec-sink-volume") , ("<Print>", spawn "scrot") -- take full (all monitors) screenshot
-- increase output volume , ("M-<Print>", spawn "flameshot gui") -- launch flameshot for snipping
, ("<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")
] ]
myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $ myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $
-- mod-[1..9], Switch to workspace N -- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N -- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i) [((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
-- Mouse bindings: default actions bound to mouse events -- Mouse bindings: default actions bound to mouse events
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
-- mod-button1, Set the window to floating mode and move by dragging -- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.shiftMaster))
>> windows W.shiftMaster)) -- mod-button2, Raise the window to the top of the stack, push to master.
-- mod-button2, Raise the window to the top of the stack
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-- mod-button3, Set the window to floating mode and resize by dragging -- mod-button3, Set the window to floating mode and resize by dragging
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w , ((modm, button3), (\w -> focus w >> mouseResizeWindow w >> windows W.shiftMaster))
>> windows W.shiftMaster))
-- you may also bind events to the mouse scroll wheel (button4 and button5) -- you may also bind events to the mouse scroll wheel (button4 and button5)
] ]
--END_KEYS
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Layouts: -- Layouts:
@ -384,8 +346,9 @@ myManageHook = composeAll
, className =? "guake" --> doIgnore , className =? "guake" --> doIgnore
, className =? "barrier" --> doFloat , className =? "barrier" --> doFloat
, className =? "net-runelite-client-RuneLite" --> doFloat , className =? "net-runelite-client-RuneLite" --> doFloat
, className =? "Yad" --> doCenterFloat
, className =? "net-runelite-launcher-Launcher" --> doIgnore , className =? "net-runelite-launcher-Launcher" --> doIgnore
, className =? "steam_app_221380" --> doIgnore , className =? "steam_app_221380" --> doIgnore
, resource =? "desktop_window" --> doIgnore , resource =? "desktop_window" --> doIgnore
, (className =? "firefox" <&&> resource =? "Dialog")--> doFloat -- Float Firefox Dialog , (className =? "firefox" <&&> resource =? "Dialog")--> doFloat -- Float Firefox Dialog
, resource =? "kdesktop" --> doIgnore , resource =? "kdesktop" --> doIgnore
@ -436,6 +399,7 @@ myStartupHook = do
spawnOnce "slack &" spawnOnce "slack &"
spawnOnce "todoist &" spawnOnce "todoist &"
spawnOnce "element-desktop --hidden &" spawnOnce "element-desktop --hidden &"
spawnOnce "flameshot"
-- Start trayer last -- 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 &" 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. -- | Finally, a copy of the default bindings in simple textual tabular format.
help :: String 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", "-- launching and killing programs",
"mod-Shift-Enter Launch terminal", "mod-Shift-Enter Launch terminal",
"mod-a Launch run menu", "mod-a Launch dmenu",
"mod-Shift-a Launch ssh menu", "mod-o Launch rofi",
"mod-o Launch dmenu",
"mod-l Launch file manager",
"mod-Shift-j Close/kill the focused window", "mod-Shift-j Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms", "mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default", "mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size", "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", "-- move focus up or down the window stack",
"mod-Tab Move focus to the next window", "mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window", "mod-Shift-Tab Move focus to the previous window",
"mod-h Move focus to the next window", "mod-m Move focus to the master window",
"mod-t Move focus to the previous window",
"mod-m Move focus to the master window",
"", "",
"-- modifying the window order", "-- modifying the window order",
"mod-Return Swap the focused window and the master window", "mod-Return Swap the focused window and the master window",
"mod-Shift-h Swap the focused window with the next window", "mod-Shift-Up Swap the focused window with the next window",
"mod-Shift-t Swap the focused window with the previous window", "mod-Shift-Down Swap the focused window with the previous window",
"", "",
"-- resizing the master/slave ratio", "-- resizing the master/slave ratio",
"mod-d Shri sk the master area", "mod-Left Shrink the master area (horizontally)",
"mod-n Expand the master area", "mod-Right Expand the master area",
"mod-Up Mirror shrink master area (vertically)",
"mod-Down Mirror grow master area",
"", "",
"-- floating layer support", "-- 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", "-- increase or decrease number of windows in the master area",
"mod-w (mod-,) Increment the number of windows in the master area", "mod-w Increment the number of windows in the master area",
"mod-vL (mod-.) Deincrement the number of windows in the master area", "mod-v Deincrement the number of windows in the master area",
"", "",
"-- quit, or restart", "-- restarting Xmonad",
"mod-Shift-' Quit xmonad", "mod-' Restart xmonad",
"mod-' Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"", "",
"-- Workspaces & screens", "-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N", "mod-[1..9] Switch to workSpace N",
"mod-{',','.','p'} Switch to physical/Xinerama screens 1, 2, or 3", "mod-Shift-[1..9] Move client to workspace N",
"mod-Shift-{',','.','p'} Move client to screen 1, 2, or 3",
"", "",
"-- Mouse bindings: default actions bound to mouse events", "-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move 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", "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"] "mod-button3 Set the window to floating mode and resize by dragging"]

View File

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