From 08db1e0f2ef400d22368168deeac24d77f37d516 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 26 Aug 2022 20:19:40 +0530 Subject: added keybindings to switch monitors in XMonad --- .Xmodmap | 2 +- .config/XMonad/lib/Defaults.hs | 3 ++- .config/XMonad/lib/Hooks.hs | 1 + .config/XMonad/lib/Keybindings.hs | 8 ++++-- .config/polybar/config.ini | 51 +++++++++++++++++++++++++++++++++++++-- .config/zsh/.zshenv | 3 ++- .scripts/polystart | 2 +- .xprofile | 3 ++- 8 files changed, 64 insertions(+), 9 deletions(-) diff --git a/.Xmodmap b/.Xmodmap index c555467..2cdbb92 100644 --- a/.Xmodmap +++ b/.Xmodmap @@ -98,7 +98,7 @@ keycode 104 = KP_Enter NoSymbol KP_Enter keycode 105 = Control_R NoSymbol Control_R keycode 106 = KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide XF86Ungrab keycode 107 = Print Sys_Req Print Sys_Req -keycode 108 = Alt_R Meta_R Alt_R Meta_R +keycode 108 = Super_L NoSymbol Super_L keycode 109 = Linefeed NoSymbol Linefeed keycode 110 = Home NoSymbol Home keycode 111 = Up NoSymbol Up diff --git a/.config/XMonad/lib/Defaults.hs b/.config/XMonad/lib/Defaults.hs index dd1f364..74fa96a 100644 --- a/.config/XMonad/lib/Defaults.hs +++ b/.config/XMonad/lib/Defaults.hs @@ -63,7 +63,8 @@ myWorkspaces = ["一", "二", "三", "四", "五", "六", "七", "八", " sGap = 3 wGap = 4 -myGap = spacingRaw True (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True +-- myGap = spacingRaw True (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True +myGap = spacingRaw False (Border sGap sGap sGap sGap) True (Border wGap wGap wGap wGap) True myTabTheme = def { fontName = myFont diff --git a/.config/XMonad/lib/Hooks.hs b/.config/XMonad/lib/Hooks.hs index 5e13225..66540e5 100644 --- a/.config/XMonad/lib/Hooks.hs +++ b/.config/XMonad/lib/Hooks.hs @@ -33,5 +33,6 @@ myLayoutHook = avoidStruts $ maximize $ windowNavigation $ smartBorders $ myGap myStartupHook = do setWMName "Anime Thighs" + spawnOnce "secondmonitor.sh" -- setWMName "LG3D" setDefaultCursor xC_left_ptr diff --git a/.config/XMonad/lib/Keybindings.hs b/.config/XMonad/lib/Keybindings.hs index 6738e3c..708ae90 100644 --- a/.config/XMonad/lib/Keybindings.hs +++ b/.config/XMonad/lib/Keybindings.hs @@ -90,8 +90,8 @@ myKeybindings = [ , ((myModShiftMask, xK_bracketright), shiftNextScreen >> nextScreen) -- swap different screens - , ((myModMask .|. controlMask, xK_bracketleft ), swapPrevScreen) - , ((myModMask .|. controlMask, xK_bracketright), swapNextScreen) + , ((myModMask .|. controlMask, xK_bracketleft ), swapPrevScreen >> prevScreen) + , ((myModMask .|. controlMask, xK_bracketright), swapNextScreen >> nextScreen) -- toggle maximize , ((myModMask, xK_f), withFocused (sendMessage . maximizeRestore)) @@ -140,6 +140,10 @@ myKeybindings = [ ((m .|. myModMask, k), windows $ f i) | (i, k) <- zip myWorkspaces [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] + ] ++ [ -- directly focus monitors instead of cycling + ((m .|. myModMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_e, xK_w] [0..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] ] myKeybindingsP :: [(String, X())] diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index 2786f49..68faf65 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -85,8 +85,56 @@ batt-discharging-fg = ${colors.module-color-1} batt-full-bg = ${colors.module-bg} batt-full-fg = ${colors.module-color-0} +; same as mybar but on second monitor +; also has different font size, bar height, etc +; modules are the same and should be synced if either is changed +[bar/mybar2] +monitor = ${env:MONITOR:HDMI-0} +enable-ipc = true +width = 100% +height = 20 +offset-x = 0 +offset-y = 0 +radius = 0 +fixed-center = true +bottom = 0 + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 0 +line-color = #f00 + +border-size = 0 +border-color = #00000000 + +padding-left = 0 +padding-right = 0 + +module-margin-left = 0 +module-margin-right = 0 + +font-0 = "SauceCodePro:style=Regular:size=9;3" +font-1 = "Source Han Sans JP Normal:size=9;3" +font-2 = "RobotoMono Nerd Font Mono:size=22;5" +font-3 = fixed:pixelsize=10;1 +;font-4 = unifont:fontformat=truetype:size=8:antialias=false;0 +;font-5 = siji:pixelsize=10;1 + +modules-left = date uptime wlan eth filesystem-root filesystem-home filesystem-hdd cpu temperature memory xwindow +modules-right = pulseaudio ewmh battery + +tray-position = right +tray-padding = 2 +tray-background = ${colors.systray-bg} + +override-redirect = true + +cursor-click = pointer +cursor-scroll = ns-resize + [bar/mybar] -;monitor = ${env:MONITOR:eDP-1-1} +;monitor = ${env:MONITOR:eDP-1} enable-ipc = true width = 100% height = 28 @@ -119,7 +167,6 @@ font-3 = fixed:pixelsize=10;1 ;font-5 = siji:pixelsize=10;1 modules-left = date uptime wlan eth filesystem-root filesystem-home filesystem-hdd cpu temperature memory xwindow -;modules-center = xwindow modules-right = pulseaudio ewmh battery tray-position = right diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv index aa01b59..77f8e54 100644 --- a/.config/zsh/.zshenv +++ b/.config/zsh/.zshenv @@ -1,7 +1,8 @@ export EDITOR="nvim" export VISUAL="emacs" export TERMINAL="st" -export BROWSER="librewolf" +# export BROWSER="librewolf" +export BROWSER="librewolf --private-window" export READER="zathura" export COLORTERM="truecolor" export PAGER="bat" diff --git a/.scripts/polystart b/.scripts/polystart index af25059..b35dda1 100755 --- a/.scripts/polystart +++ b/.scripts/polystart @@ -1,4 +1,4 @@ #!/bin/sh killall polybar -polybar mybar +polybar mybar & polybar mybar2 diff --git a/.xprofile b/.xprofile index d464d42..1b1a028 100755 --- a/.xprofile +++ b/.xprofile @@ -25,4 +25,5 @@ nitrogen --restore & emacs --daemon & udiskie & polystart & -xrandr | grep "HDMI-0 connected" && secondmonitor.sh +# xrandr | grep "HDMI-0 connected" && secondmonitor.sh +# secondmonitor.sh -- cgit v1.2.3