add multimonitor support

This commit is contained in:
Leon Kowarschick 2020-05-07 16:05:16 +02:00
parent fe3d52094d
commit f92fc0173c
5 changed files with 30 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{ {
"optOut": false, "optOut": false,
"lastUpdateCheck": 1588611001406 "lastUpdateCheck": 1588770448547
} }

View file

@ -40,6 +40,7 @@ alert = #bd2c40
;; Bar config ----------------------------------------- {{{ ;; Bar config ----------------------------------------- {{{
[bar/main] [bar/main]
monitor = ${env:MONITOR:}
override-redirect = true override-redirect = true
wm-restack = xmonad wm-restack = xmonad

View file

@ -2,4 +2,10 @@
killall -q polybar killall -q polybar
echo "---" | tee -a /tmp/polybar1.log /tmp/polybar2.log 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 &

View file

@ -154,6 +154,7 @@ myStartupHook = do
spawnOnce "redshift -P -O 5000" spawnOnce "redshift -P -O 5000"
spawn "xset r rate 300 50" -- make key repeat quicker spawn "xset r rate 300 50" -- make key repeat quicker
spawn "/home/leon/.config/polybar/launch.sh" 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" spawn "feh --bg-fill /home/leon/Bilder/wallpapers/mountains_with_clounds.jpg"
setWMName "LG3D" -- Java stuff hack setWMName "LG3D" -- Java stuff hack
@ -165,6 +166,14 @@ myStartupHook = do
removedKeys :: [String] removedKeys :: [String]
removedKeys = ["M-S-c", "M-S-q", "M-h", "M-l"] 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 :: [(String, X ())]
myKeys = [ ("M-+", sendMessage zoomIn) myKeys = [ ("M-+", sendMessage zoomIn)
, ("M--", sendMessage zoomOut) , ("M--", sendMessage zoomOut)
@ -183,14 +192,20 @@ myKeys = [ ("M-+", sendMessage zoomIn)
, ("<XF86AudioRaiseVolume>", spawn "amixer sset Master 5%+") , ("<XF86AudioRaiseVolume>", spawn "amixer sset Master 5%+")
, ("<XF86AudioLowerVolume>", spawn "amixer sset Master 5%-") , ("<XF86AudioLowerVolume>", 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 -- programs
, ("M-p", spawn myLauncher) , ("M-p", spawn myLauncher)
, ("M-b", spawn myBrowser) , ("M-b", spawn myBrowser)
, ("M-C-p", spawn (myTerminal ++ " --class termite_floating -e fff")) , ("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-p", Rofi.showCombi (def { Rofi.theme = Rofi.bigTheme }) [ "drun", "window", "ssh" ])
, ("M-S-e", Rofi.showNormal (def { Rofi.theme = Rofi.bigTheme }) "emoji" ) , ("M-S-e", Rofi.showNormal (def { Rofi.theme = Rofi.bigTheme }) "emoji" )
, ("M-s", spawn $ scriptFile "rofi-search.sh") --, ("M-s", spawn $ scriptFile "rofi-search.sh")
, ("M-S-s", spawn $ scriptFile "rofi-open.sh") , ("M-S-o", spawn $ scriptFile "rofi-open.sh")
, ("M-n", scratchpadSubmap ) , ("M-n", scratchpadSubmap )
, ("M-m", mediaSubmap ) , ("M-m", mediaSubmap )
, ("M-e", Rofi.promptRunCommand def specialCommands) , ("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 ] windowGoMappings = [ ("M-M1-" ++ key, Nav2d.windowGo dir False) | (key, dir) <- keyDirPairs ]
windowSwapMappings = [ ("M-S-M1-" ++ key, Nav2d.windowSwap dir False) | (key, dir) <- keyDirPairs ] windowSwapMappings = [ ("M-S-M1-" ++ key, Nav2d.windowSwap dir False) | (key, dir) <- keyDirPairs ]
resizeMappings = resizeMappings =
[ ("M-C-h", ifLayoutIs "BSP" (sendMessage $ ExpandTowards L) (sendMessage Shrink)) [ ("M-C-h", ifLayoutIs "BSP" (sendMessage $ ExpandTowards L) (ifLayoutIs "Horizon" (sendMessage ShrinkSlave) (sendMessage Shrink)))
, ("M-C-j", ifLayoutIs "BSP" (sendMessage $ ExpandTowards D) (sendMessage MirrorShrink >> sendMessage ExpandSlave)) , ("M-C-j", ifLayoutIs "BSP" (sendMessage $ ExpandTowards D) (ifLayoutIs "Horizon" (sendMessage Expand) (sendMessage MirrorShrink >> sendMessage ExpandSlave)))
, ("M-C-k", ifLayoutIs "BSP" (sendMessage $ ExpandTowards U) (sendMessage MirrorExpand >> sendMessage ShrinkSlave)) , ("M-C-k", ifLayoutIs "BSP" (sendMessage $ ExpandTowards U) (ifLayoutIs "Horizon" (sendMessage Shrink) (sendMessage MirrorExpand >> sendMessage ShrinkSlave)))
, ("M-C-l", ifLayoutIs "BSP" (sendMessage $ ExpandTowards R) (sendMessage Expand)) , ("M-C-l", ifLayoutIs "BSP" (sendMessage $ ExpandTowards R) (ifLayoutIs "Horizon" (sendMessage ExpandSlave) (sendMessage Expand)))
] ]
toggleFullscreen :: X () toggleFullscreen :: X ()