Lade die Konfiguration von xmobar neu


1

Ich benutze gerne xmobar mit xmonad als Fenstermanager.

Beim Ändern der Konfiguration von xmonad verwende ich mod+ q, um die neue Konfiguration wirksam zu machen.

Dies funktioniert gut für xmonad, aber mir ist aufgefallen, dass xmobar seine Konfiguration nicht neu lädt.

Wie kann ich die Konfiguration von xmobar neu laden?


Meine aktuelle Konfiguration in xmonad.hsist

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

main = do

  xmproc <- spawnPipe "xmobar"

  xmonad $ defaultConfig {
          manageHook = manageDocks <+> manageHook defaultConfig
        , layoutHook = avoidStruts  $
                      layoutHook defaultConfig
        -- Without this, the xmonad pane would hide xmobar
        -- From https://unix.stackexchange.com/questions/288037/xmobar-does-not-appear-on-top-of-window-stack-when-xmonad-starts/303242
        , handleEventHook = handleEventHook defaultConfig <+> docksEventHook
        , logHook = dynamicLogWithPP xmobarPP
                        { ppOutput = hPutStrLn xmproc
                        , ppTitle = xmobarColor "green" "" . shorten 50
                        }
        , modMask = mod4Mask     -- Rebind Mod to the Windows key
        , terminal = "urxvt"
        , borderWidth = 1
        , normalBorderColor = "#edf9ee"
        , focusedBorderColor = "dark green"
        , focusFollowsMouse = False
        } `additionalKeys`
        [
          -- Toggle xmobar using mod + b
          ((mod4Mask, xK_b), sendMessage ToggleStruts)
          -- Make a screenshot of the whole screen with the print key
        , ((0, xK_Print), spawn "import -window root screenshot_$(date +%F_%H-%M-%S).png")
        ]

Dies ist die Konfiguration von .xmobarrc:

-- Configure the status bar for xmonad: https://wiki.archlinux.org/index.php/Xmobar
Config { font = "-*-Fixed-Bold-R-Normal-*-15-*-*-*-*-*-*-*"
        , borderColor = "black"
        , border = TopB
        , bgColor = "blue"
        , fgColor = "grey"
        , position = TopW L 100
        , commands = [ Run MultiCpu ["-t","Cpu: <total0> <total1> <total2> <total3>","-L","30","-H","60","-h","#FFB6B0","-l","#CEFFAC","-n","#FFFFCC","-w","3"] 10
                     , Run Memory ["-t","Mem: <usedratio>%"] 10
                     , Run Battery ["-t","Bat: <left>% / <timeleft>","-L","30","-H","60","-h","green","-n","yellow","-l","red"] 10
                     , Run Com "uname" ["-s","-r"] "" 36000
                     , Run Date "%a %F %H:%M" "date" 10
                     ]
        , sepChar = "%"
        , alignSep = "}{"
        , template = "%multicpu% | %memory% | %battery%}{<fc=#ee9a00>%date%</fc> | %uname% "
        , hideOnStart = False
        , persistent = True
        }

Antworten:


1

Wenn Sie xmonad so eingerichtet haben, dass es xmobar startet:

main = xmonad <=< xmobar $ defaultConfig
        { terminal = "xterm"
        -- , modMask = mod4Mask
        , borderWidth = 3
        } `additionalKeys`
        [ ((mod1Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -l")
        ]

dann musst du xmonad einfach mit neu laden mod-q, um xmonad und xmobar neu zu laden.


0

Da xmonad eine neu gestartete xmobar einwandfrei anzeigen wird, verwende ich

killall xmobar; xmobar &

In meinem Terminal werden die Änderungen .xmobarrcwirksam.

Durch die Nutzung unserer Website bestätigen Sie, dass Sie unsere Cookie-Richtlinie und Datenschutzrichtlinie gelesen und verstanden haben.
Licensed under cc by-sa 3.0 with attribution required.