From f92fc0173c1126299e192c4ad3abe0084d48c32e Mon Sep 17 00:00:00 2001 From: Leon Kowarschick Date: Thu, 7 May 2020 16:05:16 +0200 Subject: [PATCH] add multimonitor support --- .../configstore/update-notifier-npm.json | 2 +- files/.config/polybar/config.ini | 1 + files/.config/polybar/launch.sh | 8 +++++- files/.xmonad/.stack-work/stack.sqlite3 | Bin 561152 -> 561152 bytes files/.xmonad/lib/Config.hs | 27 ++++++++++++++---- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/files/.config/configstore/update-notifier-npm.json b/files/.config/configstore/update-notifier-npm.json index 3f4e800..1441d06 100644 --- a/files/.config/configstore/update-notifier-npm.json +++ b/files/.config/configstore/update-notifier-npm.json @@ -1,4 +1,4 @@ { "optOut": false, - "lastUpdateCheck": 1588611001406 + "lastUpdateCheck": 1588770448547 } \ No newline at end of file diff --git a/files/.config/polybar/config.ini b/files/.config/polybar/config.ini index e4d5c12..21c2aea 100644 --- a/files/.config/polybar/config.ini +++ b/files/.config/polybar/config.ini @@ -40,6 +40,7 @@ alert = #bd2c40 ;; Bar config ----------------------------------------- {{{ [bar/main] +monitor = ${env:MONITOR:} override-redirect = true wm-restack = xmonad diff --git a/files/.config/polybar/launch.sh b/files/.config/polybar/launch.sh index 839a3c3..a67e0ef 100755 --- a/files/.config/polybar/launch.sh +++ b/files/.config/polybar/launch.sh @@ -2,4 +2,10 @@ killall -q polybar echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log -polybar --config=/home/leon/.config/polybar/config.ini main >>/tmp/polybar1.log 2>&1 & + +# for loop only for multi monitor +for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + MONITOR=$m polybar --config=/home/leon/.config/polybar/config.ini main >>/tmp/polybar1.log 2>&1 & +done + +#polybar --config=/home/leon/.config/polybar/config.ini main >>/tmp/polybar1.log 2>&1 & diff --git a/files/.xmonad/.stack-work/stack.sqlite3 b/files/.xmonad/.stack-work/stack.sqlite3 index f06a0e1e6d1a1ade0e1d44e739be2e47d0d64ddd..3cf5787e7bd61b737dc48f3679f1652d67dc7a0f 100644 GIT binary patch delta 199 zcmZozpwzHHX@WFk^+XwG#_Gm|)&$1Z1g6#m=B)`V%lyT78TcA`{_`+%bujXB+-LV; z-OM7%R6AKw;qLUG0W2asO}XBj42hDtoGqdp(?1%qXiZm&VG*DH?-_f+O_PQYUj$S@t2EKTnGu(!p(>R#fgf}ZH{AcBB d&S@0oVra5AhnqZe`i*Do(=ZI(4m4DF1pwN2M%n-X delta 169 zcmZozpwzHHX@WFk#Y7or#)`&-)&$1Z1g6#m=B)`V%lyT(8TcA`{_`+%buemk+-LV; z-OM7%R6AKw;qLUG0W2bu4HV>fn*6;v84@LPIh!LnrhhbI(VFfY$kIOjLm^}R^taF1 z#oOzGSb&%nh}pK+1+jPZ@);{ZrGqwZG5MBWQr!Y1v diff --git a/files/.xmonad/lib/Config.hs b/files/.xmonad/lib/Config.hs index e713073..289c8c9 100644 --- a/files/.xmonad/lib/Config.hs +++ b/files/.xmonad/lib/Config.hs @@ -154,6 +154,7 @@ myStartupHook = do spawnOnce "redshift -P -O 5000" spawn "xset r rate 300 50" -- make key repeat quicker spawn "/home/leon/.config/polybar/launch.sh" + spawn "/home/leon/.screenlayout/dualscreen.sh" spawn "feh --bg-fill /home/leon/Bilder/wallpapers/mountains_with_clounds.jpg" setWMName "LG3D" -- Java stuff hack @@ -165,6 +166,14 @@ myStartupHook = do removedKeys :: [String] removedKeys = ["M-S-c", "M-S-q", "M-h", "M-l"] +multiMonitorOperation :: (WorkspaceId -> WindowSet -> WindowSet) -> ScreenId -> X () +multiMonitorOperation operation n = do + monitor <- screenWorkspace n + case monitor of + Just mon -> windows $ operation mon + Nothing -> return () + + myKeys :: [(String, X ())] myKeys = [ ("M-+", sendMessage zoomIn) , ("M--", sendMessage zoomOut) @@ -183,14 +192,20 @@ myKeys = [ ("M-+", sendMessage zoomIn) , ("", spawn "amixer sset Master 5%+") , ("", spawn "amixer sset Master 5%-") + -- Multi monitor + , ("M-s", multiMonitorOperation W.view 0) + , ("M-d", multiMonitorOperation W.view 1) + , ("M-S-s", (multiMonitorOperation W.shift 0) >> multiMonitorOperation W.view 0) + , ("M-S-d", (multiMonitorOperation W.shift 1) >> multiMonitorOperation W.view 1) + -- programs , ("M-p", spawn myLauncher) , ("M-b", spawn myBrowser) , ("M-C-p", spawn (myTerminal ++ " --class termite_floating -e fff")) , ("M-S-p", Rofi.showCombi (def { Rofi.theme = Rofi.bigTheme }) [ "drun", "window", "ssh" ]) , ("M-S-e", Rofi.showNormal (def { Rofi.theme = Rofi.bigTheme }) "emoji" ) - , ("M-s", spawn $ scriptFile "rofi-search.sh") - , ("M-S-s", spawn $ scriptFile "rofi-open.sh") + --, ("M-s", spawn $ scriptFile "rofi-search.sh") + , ("M-S-o", spawn $ scriptFile "rofi-open.sh") , ("M-n", scratchpadSubmap ) , ("M-m", mediaSubmap ) , ("M-e", Rofi.promptRunCommand def specialCommands) @@ -209,10 +224,10 @@ myKeys = [ ("M-+", sendMessage zoomIn) windowGoMappings = [ ("M-M1-" ++ key, Nav2d.windowGo dir False) | (key, dir) <- keyDirPairs ] windowSwapMappings = [ ("M-S-M1-" ++ key, Nav2d.windowSwap dir False) | (key, dir) <- keyDirPairs ] resizeMappings = - [ ("M-C-h", ifLayoutIs "BSP" (sendMessage $ ExpandTowards L) (sendMessage Shrink)) - , ("M-C-j", ifLayoutIs "BSP" (sendMessage $ ExpandTowards D) (sendMessage MirrorShrink >> sendMessage ExpandSlave)) - , ("M-C-k", ifLayoutIs "BSP" (sendMessage $ ExpandTowards U) (sendMessage MirrorExpand >> sendMessage ShrinkSlave)) - , ("M-C-l", ifLayoutIs "BSP" (sendMessage $ ExpandTowards R) (sendMessage Expand)) + [ ("M-C-h", ifLayoutIs "BSP" (sendMessage $ ExpandTowards L) (ifLayoutIs "Horizon" (sendMessage ShrinkSlave) (sendMessage Shrink))) + , ("M-C-j", ifLayoutIs "BSP" (sendMessage $ ExpandTowards D) (ifLayoutIs "Horizon" (sendMessage Expand) (sendMessage MirrorShrink >> sendMessage ExpandSlave))) + , ("M-C-k", ifLayoutIs "BSP" (sendMessage $ ExpandTowards U) (ifLayoutIs "Horizon" (sendMessage Shrink) (sendMessage MirrorExpand >> sendMessage ShrinkSlave))) + , ("M-C-l", ifLayoutIs "BSP" (sendMessage $ ExpandTowards R) (ifLayoutIs "Horizon" (sendMessage ExpandSlave) (sendMessage Expand))) ] toggleFullscreen :: X ()