From 9441d733e6e5432c6dbeb527ee1c68c6a029fdb9 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Mon, 24 May 2021 14:09:17 +0930 Subject: [PATCH] updated xmonad keybindings to ez config keys --- .config/xmobar/xmobarrc-main.hs | 5 +- .xmonad/xmonad.hs | 301 ++++++++++++-------------------- default-programs | 2 + 3 files changed, 119 insertions(+), 189 deletions(-) diff --git a/.config/xmobar/xmobarrc-main.hs b/.config/xmobar/xmobarrc-main.hs index b35ebe5..b34a348 100644 --- a/.config/xmobar/xmobarrc-main.hs +++ b/.config/xmobar/xmobarrc-main.hs @@ -12,8 +12,7 @@ Config { -- layout , sepChar = "%" -- delineator between plugin names and straight text , alignSep = "}{" -- separator between left-right alignment - , template = " %cpu% %memory% %dynnetwork% } %UnsafeStdinReader% { %date% | %YPAD% | %battery% | %updates% %trayerpad%" - } + , template = " %cpu% %memory% %dynnetwork% %battery% } %UnsafeStdinReader% { %date% | %YPAD% | %updates% %trayerpad%" -- general behavior , lowerOnStart = True -- send to bottom of window stack on start @@ -104,7 +103,7 @@ Config { -- based upon your specific hardware. Or, for a desktop you may want -- to just remove this section entirely. , Run BatteryP ["BAT0"] - [ "--template", "%, " + [ "--template", " %, " , "-L", "10", "-H", "80" , "-l", "#882410", "-h", "#95C05D" , "--", "-O", "Charging", "-o", "Battery" diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index e30cd1e..bee3f7d 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -146,190 +146,122 @@ clickable ws = ""++ws++"" ------------------------------------------------------------------------ -- Key bindings. Add, modify or remove key bindings here. --- These are general keybindings custom script bindings are not included. +-- These are general keybindings custom script bindings are not included.h + +myEZKeys :: [(String, X ())] +myEZKeys = + + -- xmonad + [ ("M-'", spawn "xmonad --recompile; xmonad --restart") + + -- open my terminal + , ("M-S-", spawn (myTerminal)) + + -- run launchers + , ("M-a", spawn "dmenu_run -bw 3 -c -l 15 -h 26") + , ("M-o", spawn "rofi -show run") + + -- keybound programs + , ("M-l", spawn (myFileManager)) + + -- wm controls + -- kill focused windown + , ("M-S-j", kill1) + -- rotate through layouts + , ("M-", sendMessage NextLayout) + -- reset layout to default + -- , ("M-S-", setLayout $ Xmonad.layoutHook conf) + -- reset current window to correct size + , ("M-S-y", refresh) + -- focus next window + , ("M-", windows W.focusDown) + -- focus previous window + , ("M-S-", windows W.focusUp) + -- focus master window + , ("M-m", windows W.focusMaster) + -- swap window with master + , ("M-", windows W.swapMaster) + -- swap window with next window + , ("M-S-", windows W.swapDown) + -- swap window with previous window + , ("M-S-", windows W.swapUp) + -- shrink master area + , ("M-", sendMessage Shrink) + -- grow master area + , ("M-", sendMessage Expand) + -- shrink master area + , ("M-", sendMessage MirrorShrink) + -- grow master area + , ("M-", 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 + -- 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-", spawn "$HOME/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1") + + -- unlock bitwarden cli + , ("M-S-x", spawn "$HOME/.local/bin/bw-unlock") + -- get password from bw cli + , ("M-x", spawn "$HOME/.local/bin/passwords") + + -- launch searcher (dmenu and surf) + , ("M-s", spawn "$HOME/.local/bin/dmenusearch") + -- launch searcher, default to duckduckgo + , ("M-s d", spawn "$HOME/.local/bin/dmenusearch duckduckgo") + + -- launch mounter + , ("M-m m", spawn "$HOME/.local/bin/dmenumount") + -- launch unmounter + , ("M-m u", spawn "$HOME/.local/bin/dmendduumount") + + -- backlight controls + -- increase backlight brightness by 10 + , ("", spawn "$HOME/.local/bin/mod_backlight +10") + -- decrease backlight brightness by 10 + , ("", spawn "$HOME/.local/bin/mod_backlight -10") + + -- music and audio controls + -- decrease output volume + , ("", spawn "$HOME/.local/bin/dec-sink-volume") + -- increase output volume + , ("", spawn "$HOME/.local/bin/inc-sink-volume") + -- toggle output mute + , ("", spawn "$HOME/.local/bin/toggle-sink-mute") + -- decrease input volume + , ("S-", spawn "$HOME/.local/bin/dec-source-volume") + -- increase input volume + , ("S-", spawn "$HOME/.local/bin/inc-source-volume") + -- toggle input mute + , ("S-", 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 + , ("", spawn "flameshot gui") + ] + myKeys conf@XConfig {XMonad.modMask = modm} = M.fromList $ - - [ - -- launch a terminal - ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) - - -- launch rofi - , ((modm, xK_o ), spawn "rofi -show run") - - -- launch dmenu - , ((modm, xK_a ), spawn "dmenu_run -bw 3 -c -l 15 -h 26") - - -- launch rofi ssh - , ((modm .|. shiftMask, xK_o ), spawn "rofi -show ssh") - - -- launch my file manager - , ((modm, xK_l ), spawn myFileManager) - - -- close focused window - , ((modm .|. shiftMask, xK_j ), kill) - - -- Rotate through the available layout algorithms - , ((modm, xK_space ), sendMessage NextLayout) - - -- Reset the layouts on the current workspace to default - , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) - - -- Resize viewed windows to the correct size - , ((modm .|. shiftMask, xK_y ), refresh) - - -- Move focus to the next window - , ((modm, xK_Tab ), windows W.focusDown) - - -- Move focus to the next window - , ((modm .|. shiftMask, xK_Tab ), windows W.focusUp) - - -- Move focus to the next window - , ((modm, xK_h ), windows W.focusDown) - - -- Move focus to the previous window - , ((modm, xK_t ), windows W.focusUp ) - - -- Move focus to the master window - , ((modm, xK_m ), windows W.focusMaster ) - - -- Swap the focused window and the master window - , ((modm, xK_Return), windows W.swapMaster) - - -- Swap the focused window with the next window - , ((modm .|. shiftMask, xK_Down ), windows W.swapDown ) - - -- Swap the focused window with the previous window - , ((modm .|. shiftMask, xK_Up ), windows W.swapUp ) - - -- Shrink the master area - , ((modm, xK_Left ), sendMessage Shrink) - - -- Expand the master area - , ((modm, xK_Right ), sendMessage Expand) - - -- Push window back into tiling - , ((modm, xK_y ), withFocused $ windows . W.sink) - - -- Increment the number of windows in the master area - , ((modm, xK_w ), sendMessage (IncMasterN 1)) - - -- Deincrement the number of windows in the master area - , ((modm, xK_v ), sendMessage (IncMasterN (-1))) - - -- Toggle the status bar gap - -- Use this binding with avoidStruts from Hooks.ManageDocks. - -- See also the statusBar function from Hooks.DynamicLog. - -- - , ((modm, xK_b ), sendMessage ToggleStruts) - - -- Restart xmonad - , ((modm, xK_apostrophe ), spawn "xmonad --recompile; xmonad --restart") - - -- Run xmessage with a summary of the default keybindings (useful for beginners) - , ((modm .|. shiftMask, xK_z ), spawn ("echo \"" ++ help ++ "\" | xmessage -file -")) - ] - ++ - - -- - -- these are my general custom bindings and scripts - -- - [ - -- prompt computer shutdown - ((modm .|. shiftMask, xK_s ), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to Shutdown?\" \"shutdown now\"") - - -- prompt computer reboot - , ((modm .|. shiftMask, xK_r ), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to Restart?\" \"reboot\"") - - - -- prompt computer lock - , ((modm, xK_Escape), spawn "/home/solomon/.local/bin/prompt \"Are you sure you want to lock?\" \"slock\" 1") - - -- unlock bitwarden cli and store session key - , ((modm .|. shiftMask, xK_x ), spawn "/home/solomon/.local/bin/bw-unlock") - - -- search for password using bitwarden cli through dmenu - , ((modm, xK_x ), spawn "/home/solomon/.local/bin/passwords") - - -- launch searcher - , ((modm, xK_s ), spawn "/home/solomon/.local/bin/dmenusearch") - - , ((modm, xK_s), submap . M.fromList $ - [ - -- just open dmenusearch - ((0, xK_a), spawn "/home/solomon/.local/bin/dmenusearch") - - -- open dmenusearch with duckduckgo preselected - , ((0, xK_d), spawn "/home/solomon/.local/bin/dmenusearch duckduckgo") - ]) - - -- launch mounter - , ((modm, xK_c ), spawn "/home/solomon/.local/bin/dmenumount") - - -- launch unmounter - , ((modm .|. shiftMask, xK_c ), spawn "/home/solomon/.local/bin/dmendduumount") - - ] - ++ - - -- - -- music controlls as I figure them out - --por - [ - -- decrease volume with mod+f11 - ((modm, xK_F11), spawn "/home/solomon/.local/bin/dec-sink-volume") - - -- increase volume with mod+f12 - , ((modm, xK_F12), spawn "/home/solomon/.local/bin/inc-sink-volume") - - -- toggle mute with mod+f10 - , ((modm, xK_F10), spawn "/home/solomon/.local/bin/toggle-sink-mute") - - -- decrease volume with mod+f11 - , ((modm .|. shiftMask, xK_F11), spawn "/home/solomon/.local/bin/dec-source-volume") - - -- increase volume with mod+f12 - , ((modm .|. shiftMask, xK_F12), spawn "/home/solomon/.local/bin/inc-source-volume") - - -- toggle mute with mod+f10 - , ((modm .|. shiftMask, xK_F10), spawn "/home/solomon/.local/bin/toggle-source-mute") - - -- set default sink for pactl to allow above scripts to run - , ((modm, xK_F7), spawn "/home/solomon/.local/bin/set-default-sink") - - -- set default source for pactl - , ((modm .|. shiftMask, xK_F7), spawn "/home/solomon/.local/bin/set-default-source") - ] - ++ - - -- - -- hardware controls, currently just backlight - -- - [ - -- increase backlight by 10 with mod+f9 - ((modm, xK_F9), spawn "/home/solomon/.local/bin/mod_backlight +10") - - -- decrese backlight by 10 with mod+f8 - , ((modm, xK_F8), spawn "/home/solomon/.local/bin/mod_backlight -10") - ] - ++ - - -- -- 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)]] - ++ - - -- - -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 - -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 - -- - [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) - | (key, sc) <- zip [xK_comma, xK_period, xK_p] [0..] - , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] - -- Mouse bindings: default actions bound to mouse events myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList @@ -440,11 +372,11 @@ myLayout = avoidStruts $ mouseResize $ windowArrange $ T.toggleLayouts floats -- a new window. You can use this to, for example, always float a -- particular program, or have a client always appear on a particular -- workspace. --- + -- To find the property name associated with a program, use -- > xprop | grep WM_CLASS -- and click on the client you're interested in. --- + -- To match on the WM_NAME, you can use 'title' in the same way that -- 'className' and 'resource' are used below. myManageHook = composeAll @@ -466,7 +398,7 @@ myManageHook = composeAll -- Event handling -- * EwmhDesktops users should change this to ewmhDesktopsEventHook --- + -- Defines a custom handler function for X Events. The function should -- return (All True) if the default handler is to be run afterwards. To -- combine event hooks use mappend or mconcat from Data.Monoid. @@ -485,7 +417,7 @@ myLogHook = fadeInactiveLogHook fadeAmount -- Perform an arbitrary action each time xmonad starts or is restarted -- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize -- per-workspace layout choices. --- + -- By default, do nothing. myStartupHook = do -- Startup apps (tray) and settings @@ -524,10 +456,7 @@ main = do xmproc0 <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-main.hs" xmproc1 <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc-sub.hs" xmproc2 <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc-sub.hs" - -- xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc0" - -- xmproc <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc1" - -- xmproc <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc2" - -- xmonad =<< statusBar myBar myPP toggleStrutsKey defaults + xmonad $ ewmh $ docks def -- defaults = def { @@ -566,7 +495,7 @@ main = do , ppOrder = \(ws:l:t:ex) -> [ws,l] }, startupHook = myStartupHook - } + } `additionalKeysP` myEZKeys -- | Finally, a copy of the default bindings in simple textual tabular format. help :: String diff --git a/default-programs b/default-programs index d888143..ca869de 100644 --- a/default-programs +++ b/default-programs @@ -1,5 +1,7 @@ git-flow-completion-git +plexamp-appimage +element-desktop shotwell fish evince