From 75f5df5aed5f7db7489aba96ef16cb560d2610e9 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 1 Dec 2022 16:13:46 +0100 Subject: [PATCH 1/4] Update 'nvim' aliases --- .bash_aliases | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bash_aliases b/.bash_aliases index a427c9e..0a83688 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -48,12 +48,13 @@ alias df="df -kTh" alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S" alias o="xdg-open" alias path="echo -e ${PATH//:/\\n}" # Pretty print path variables -alias wiki="vim +WikiIndex" # Programs alias feh="feh -B black --scale-down --auto-zoom" alias fm='pcmanfm' +alias v="nvim" +alias w="nvim +WikiIndex" alias g='git' alias lm='xbacklight -set' alias py='python' From 671e9ed919e0381a3d0f2caadaedabe4495130e0 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 1 Dec 2022 16:16:35 +0100 Subject: [PATCH 2/4] Update 'xmobar' config --- .xmobarrc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.xmobarrc b/.xmobarrc index fc80144..90e5e57 100644 --- a/.xmobarrc +++ b/.xmobarrc @@ -1,13 +1,21 @@ Config { overrideRedirect = False , font = "xft:Iosevka Term SS08:size=12:antialias=true" - , bgColor = "#111" - , fgColor = "#ccc" - , position = TopW L 90 + , bgColor = "#cccccc" + , fgColor = "#111" + , position = TopW L 100 , commands = [ Run Cpu [ "-L", "3" , "-H", "50" , "--high" , "red" - , "--normal", "green" + ] 10 + , Run Battery [ + "-t", ": % - ", + "--", + --"-c", "charge_full", + "-O", "AC", + "-o", "Bat", + "-h", "green", + "-l", "red" ] 10 , Run Alsa "default" "Master" [ "--template", "Vol: " @@ -17,9 +25,12 @@ Config { overrideRedirect = False ] , Run Memory ["--template", "Mem: %"] 10 , Run Date "%a %Y-%m-%d %H:%M" "date" 10 + , Run Com "sb-pomo" [] "pomo" 10 + , Run Com "sb-anki" [] "anki" 10 + , Run Com "sb-tasks" [] "tasks" 10 , Run XMonadLog ] , sepChar = "%" , alignSep = "}{" - , template = "%XMonadLog% }{ %alsa:default:Master% | %cpu% | %memory% | %date% " + , template = "%XMonadLog%%anki%%pomo%%tasks% }{ %alsa:default:Master% | %battery% | %date%" } From 01a3f646122d2bbf8a3e5bda02b3964e97cdec06 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 1 Dec 2022 16:18:44 +0100 Subject: [PATCH 3/4] Update 'xmobar' config --- .xmonad/xmonad.hs | 50 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 7311d20..d04a911 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -30,37 +30,39 @@ import XMonad.Util.Ungrab -- Statusbar myXmobarPP :: PP -myXmobarPP = def - { ppSep = tertiaryColor " | " - , ppCurrent = brackitify - , ppHidden = secondaryColor - , ppHiddenNoWindows = tertiaryColor - , ppUrgent = red . wrap (yellow "!") (yellow "!") - , ppLayout = \l -> case l of "Tall" -> "[]=" - "Magnifier Tall" -> "[]+" - "Magnifier (off) Tall" -> "[]=" - "Magnifier Mirror Tall" -> "+[]" - "Magnifier (off) Mirror Tall" -> "=[]" - "Full" -> "[ ]" - "ThreeCol" -> "|||" - _ -> l - , ppTitle = shorten 80 - , ppTitleSanitize = xmobarStrip - , ppOrder = \[ws, l, _, wins] -> [ws, l, wins] - , ppExtras = [logTitles formatFocused formatUnfocused] +myXmobarPP = + def + { ppSep = tertiaryColor " | ", + ppCurrent = brackitify, + ppHidden = secondaryColor, + ppHiddenNoWindows = tertiaryColor, + ppUrgent = red . wrap (yellow "!") (yellow "!"), + ppLayout = \l -> case l of + "Tall" -> "[]=" + "Magnifier Tall" -> "[]+" + "Magnifier (off) Tall" -> "[]=" + "Magnifier Mirror Tall" -> "+[]" + "Magnifier (off) Mirror Tall" -> "=[]" + "Full" -> "[ ]" + "ThreeCol" -> "|||" + _ -> l, + ppTitle = shorten 80, + ppTitleSanitize = xmobarStrip, + ppOrder = \[ws, l, _, wins] -> [ws, l, wins], + ppExtras = [logTitles formatFocused formatUnfocused] } where brackitify = wrap "[" "]" - formatFocused = secondaryColor . brackitify . ppWindow + formatFocused = secondaryColor . brackitify . ppWindow formatUnfocused = tertiaryColor . ppWindow ppWindow = xmobarRaw . (\w -> if null w then "Untitled" else w) . shorten 16 - primaryColor = xmobarColor "#eeeeee" "" - secondaryColor = xmobarColor "#aaaaaa" "" - tertiaryColor = xmobarColor "#888888" "" - yellow = xmobarColor "#ff0" "" - red = xmobarColor "#ff5555" "" + primaryColor = xmobarColor "#000000" "" + secondaryColor = xmobarColor "#333333" "" + tertiaryColor = xmobarColor "#555555" "" + yellow = xmobarColor "#ff0" "" + red = xmobarColor "#ff5555" "" -- Shift to workspace and view workspace shiftAndView id = doF (W.view id) <> doF (W.shift id) From 19e9241ac8315aa060e9a857930084d6d52418c8 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Thu, 1 Dec 2022 16:21:19 +0100 Subject: [PATCH 4/4] Update 'xmonad' config --- .xmonad/xmonad.hs | 264 +++++++++++++++++++++++++--------------------- 1 file changed, 144 insertions(+), 120 deletions(-) diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index d04a911..e6ae607 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -1,32 +1,32 @@ -import XMonad - -import XMonad.Hooks.DynamicLog -import XMonad.Hooks.EwmhDesktops -import XMonad.Hooks.ManageDocks -import XMonad.Hooks.ManageHelpers -import XMonad.Hooks.StatusBar -import XMonad.Hooks.StatusBar.PP - -import XMonad.Layout.Magnifier -import qualified XMonad.Layout.Magnifier as Mag (MagnifyMsg (..)) -import XMonad.Layout.NoBorders (hasBorder, smartBorders) -import XMonad.Layout.PerScreen -import XMonad.Layout.ResizableTile -import XMonad.Layout.Spacing -import XMonad.Layout.ThreeColumns -import XMonad.Layout.ToggleLayouts (ToggleLayout (..), - toggleLayouts) -import XMonad.Layout.WindowNavigation - -import qualified XMonad.StackSet as W - -import XMonad.Util.EZConfig -import qualified XMonad.Util.Hacks as Hacks -import XMonad.Util.Loggers -import XMonad.Util.Paste -import XMonad.Util.Run (spawnExternalProcess, - spawnPipe) -import XMonad.Util.Ungrab +import XMonad +import XMonad.Hooks.DynamicLog +import XMonad.Hooks.EwmhDesktops +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.ManageHelpers +import XMonad.Hooks.StatusBar +import XMonad.Hooks.StatusBar.PP +import XMonad.Layout.Magnifier +import qualified XMonad.Layout.Magnifier as Mag (MagnifyMsg (..)) +import XMonad.Layout.NoBorders (hasBorder, smartBorders) +import XMonad.Layout.PerScreen +import XMonad.Layout.ResizableTile +import XMonad.Layout.Spacing +import XMonad.Layout.ThreeColumns +import XMonad.Layout.ToggleLayouts + ( ToggleLayout (..), + toggleLayouts, + ) +import XMonad.Layout.WindowNavigation +import qualified XMonad.StackSet as W +import XMonad.Util.EZConfig +import qualified XMonad.Util.Hacks as Hacks +import XMonad.Util.Loggers +import XMonad.Util.Paste +import XMonad.Util.Run + ( spawnExternalProcess, + spawnPipe, + ) +import XMonad.Util.Ungrab -- Statusbar myXmobarPP :: PP @@ -68,112 +68,136 @@ myXmobarPP = shiftAndView id = doF (W.view id) <> doF (W.shift id) -- manageHook -myManageHook = composeAll - [ - className =? "Zathura" --> doShift "pdf" - , className =? "firefox" --> shiftAndView "www" - , className =? "Anki" --> shiftAndView "etc" - , className =? "Obsidian" --> shiftAndView "etc" - , className =? "Launcher" --> doRectFloat (W.RationalRect 0.05 0.4 0.9 0.5) - , className =? "Calculator" --> doCenterFloat - , className =? "feh" --> doCenterFloat - , className =? "albert" --> hasBorder False - , className =? "Xournalpp" --> doRectFloat (W.RationalRect 0.5 0.5 0.5 0.5) - ] +myManageHook = + composeAll + [ className =? "Zathura" --> doShift "pdf", + className =? "firefox" --> shiftAndView "www", + className =? "Anki" --> shiftAndView "etc", + className =? "Obsidian" --> shiftAndView "etc", + className =? "Launcher" --> doRectFloat (W.RationalRect 0.05 0.4 0.9 0.5), + className =? "Calculator" --> doCenterFloat, + className =? "feh" --> doCenterFloat, + className =? "albert" --> hasBorder False, + className =? "Xournalpp" --> doRectFloat (W.RationalRect 0.5 0.5 0.5 0.5) + ] -- layoutHook -myLayoutHook= smartBorders $ - -- Column layouts - threeCol ||| - threeColMid ||| - -- Tiled layouts - -- Note: magnifier is off by default - -- (controllable usingarrow keys) - magnifiercz magnificationFactorH tiled ||| - magnifiercz magnificationFactorV (Mirror tiled) ||| - -- Single window / monocle layout - Full +myLayoutHook = + smartBorders $ + -- Column layouts + threeCol + ||| threeColMid + -- Tiled layouts + -- Note: magnifier is off by default + -- (controllable usingarrow keys) + ||| magnifiercz magnificationFactorH tiled + ||| magnifiercz magnificationFactorV (Mirror tiled) + -- Single window / monocle layout + ||| Full where magnificationFactorV = 1.384 magnificationFactorH = 1.621 - tiled = Tall nmaster delta ratio + tiled = Tall nmaster delta ratio threeCol = ThreeCol nmaster delta ratio threeColMid = ThreeColMid nmaster delta ratio nmaster = 1 - ratio = 1/2 - delta = 4/100 + ratio = 1 / 2 + delta = 4 / 100 -myConfig = def - { - terminal = "alacritty" - - -- Use Win key instead of Alt - , modMask = mod4Mask - , workspaces = ["α", "β", "γ", "δ", "ε", "ζ", "η"] - - -- Styling - , focusedBorderColor = "#888" - , normalBorderColor = "#000" - , borderWidth = 2 - - -- Hooks - , manageHook = myManageHook <+> manageHook def - , layoutHook = avoidStruts myLayoutHook - , handleEventHook = handleEventHook def <> Hacks.windowedFullscreenFixEventHook - } `additionalKeysP` myKeysP +myConfig = + def + { terminal = "alacritty", + -- Use Win key instead of Alt + modMask = mod4Mask, + -- , workspaces = ["α", "β", "γ", "δ", "ε", "ζ", "η"] + workspaces = + [ "sh", + "www", + "dev", + -- "nix", + "pdf", + "etc" + ], + -- Styling + focusedBorderColor = "#888", + normalBorderColor = "#000", + borderWidth = 2, + -- Hooks + manageHook = myManageHook <+> manageHook def, + layoutHook = avoidStruts myLayoutHook, + handleEventHook = handleEventHook def <> Hacks.windowedFullscreenFixEventHook + } + `additionalKeysP` myKeysP `removeKeysP` myRemoveKeysP -- Keybindings to be added/overridden -myKeysP = [ - -- Fit floating windows back to layout - ("M-S-", withFocused $ windows . W.sink) - - -- Launchers - , ("M-p", spawn "albert toggle") - - -- Map insert key to paste from clipboard - , ("", pasteSelection) - - -- Map print screen to take a screenshot with flameshot - , ("", spawn "flameshot gui") - - -- Map audio keys to control volume - , ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%") - , ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%") - , ("", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle") - - -- Map brightness keys to control brightness with brightnessctl - , ("", spawn "brightnessctl set 20+") - , ("", spawn "brightnessctl set 20-") - - -- Map brightness keys + shift to adjust redshift temperature - , ("S-", 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-", spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything") - - -- Reset redshift temperature - , ("M-S-", spawn "echo 3000 > /tmp/temperature && redshift -x") - , ("M-S-", spawn "echo 3000 > /tmp/temperature && redshift -x") - - -- Use power down key to suspend - , ("", spawn "systemctl suspend") - - -- FIXME: Spawn firefox in fullscreen, but not in kiosk mode - , ("M-S-b", spawn "firefox --fullscreen") - - -- Magnify window using arrow keys - , ("M-=", sendMessage MagnifyMore >> sendMessage Mag.ToggleOn) - , ("M--", sendMessage MagnifyLess >> sendMessage Mag.ToggleOn) - -- Reset magnification - , ("M-S-=", sendMessage Mag.ToggleOff) - -- Layouts - , ("M-t", sendMessage $ JumpToLayout "Magnifier Tall") - , ("M-c", sendMessage $ JumpToLayout "ThreeCol") - , ("M-f", sendMessage $ JumpToLayout "Full") +myKeysP = + [ -- Fit floating windows back to layout + ("M-S-", withFocused $ windows . W.sink), + -- Launchers + ("M-S-p", spawn "alacritty --class Launcher,Launcher"), + ("M-p", spawn "albert toggle"), + -- Map insert key to paste from clipboard + ("", pasteSelection), + -- Map print screen to take a screenshot with flameshot + ("", spawn "flameshot gui"), + -- Map audio keys to control volume + ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"), + ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"), + ("", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"), + -- Map brightness keys to control brightness with brightnessctl + ("", spawn "brightnessctl set 20+"), + ("", spawn "brightnessctl set 20-"), + -- Map brightness keys + shift to adjust redshift temperature + ("S-", 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-", spawn "echo $(($(cat /tmp/temperature) - 50)) > /tmp/temperature && redshift -O $(cat /tmp/temperature) -P && notify < /tmp/temperature -h string:x-canonical-private-synchronous:anything"), + -- Reset redshift temperature + ("M-S-", spawn "echo 3000 > /tmp/temperature && redshift -x"), + ("M-S-", spawn "echo 3000 > /tmp/temperature && redshift -x"), + -- Use power down key to suspend + ("", spawn "systemctl suspend"), + -- FIXME: Spawn firefox in fullscreen, but not in kiosk mode + ("M-S-b", spawn "firefox --fullscreen"), + -- Magnify window using arrow keys + ("M-=", sendMessage MagnifyMore >> sendMessage Mag.ToggleOn), + ("M--", sendMessage MagnifyLess >> sendMessage Mag.ToggleOn), + -- Reset magnification + ("M-S-=", sendMessage Mag.ToggleOff), + ("", spawn "alacritty --class 'Calculator' -e ipython -i /home/h/.bin/calc.py"), + -- playerctl ncspot using arrow keys + ("M-", spawn "playerctl next"), + ("M-", spawn "playerctl previous"), + ("M-", spawn "playerctl play"), + ("M-", spawn "playerctl pause"), + -- Use a,s,d,f,g to switch to workspaces + ("M-a", windows $ W.greedyView "sh"), + ("M-s", windows $ W.greedyView "www"), + ("M-d", windows $ W.greedyView "dev"), + ("M-f", windows $ W.greedyView "pdf"), + ("M-g", windows $ W.greedyView "etc"), + -- Use shift + a,s,d,f,g to move window to workspace + ("M-S-a", windows $ W.shift "sh"), + ("M-S-s", windows $ W.shift "www"), + ("M-S-d", windows $ W.shift "dev"), + ("M-S-f", windows $ W.shift "pdf"), + ("M-S-g", windows $ W.shift "etc") ] -- Keybindings to be removed -myRemoveKeysP = [ ] - +myRemoveKeysP = + [ -- Remove 1,2,3,4,5 bindings for workspaces + "M-1", + "M-2", + "M-3", + "M-4", + "M-5", + -- Remove shift + 1,2,3,4,5 bindings for workspaces + "M-S-1", + "M-S-2", + "M-S-3", + "M-S-4", + "M-S-5" + ] main :: IO () main = do xmonad $ docks $ ewmh $ withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey myConfig