From 16e3693dae486ea64dc23de5573965d41909cc94 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Fri, 19 Mar 2021 19:32:30 +0530 Subject: fixed xmonad status bar not starting up and made the lemonblocks bar update everytime volume was changed --- XMonad/xmonad.hs | 58 +++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/XMonad/xmonad.hs b/XMonad/xmonad.hs index 36d28f89..944068ae 100644 --- a/XMonad/xmonad.hs +++ b/XMonad/xmonad.hs @@ -59,7 +59,6 @@ import XMonad.Util.NamedScratchpad myStartupHook :: X () myStartupHook = do spawnOnce "start-lemonbar.sh" - spawnOnce "xmonad-log | lemonbar -b -g 800x21+0+0 -B '#171520' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'" spawnOnce "firefox" setWMName "AnimeThighsWM" setDefaultCursor xC_left_ptr @@ -75,7 +74,7 @@ myTerminal :: String myTerminal = "st" myLauncher :: String -myLauncher = "run_dmenu" +myLauncher = ".//home/zt/.config/scripts/run_dmenu" myBrowser :: String myBrowser = "brave" @@ -96,17 +95,17 @@ myScreenshot :: String myScreenshot = "scrot /zt/Screenshots/Screenshot-%Y-%d-%m--%T.png" myColorPicker :: String -myColorPicker = "colorpicker --short --one-shot --preview | xsel -b" +myColorPicker = ".//zt/Programs/colorpicker --short --one-shot --preview | xsel -b" -- volume myVolUp :: String -myVolUp = "pulseaudio-ctl up" +myVolUp = "pulseaudio-ctl up && killall lemonblocks -5" myVolDown :: String -myVolDown = "pulseaudio-ctl down" +myVolDown = "pulseaudio-ctl down && killall lemonblocks -5" myVolMute :: String -myVolMute = "pulseaudio-ctl mute" +myVolMute = "pulseaudio-ctl mute && killall lemonblocks -5" myFont :: String @@ -364,31 +363,30 @@ myLayoutHook = avoidStruts ( ||| tabbedRight shrinkText def ) -myLemonbarPP :: D.Client -> PP -myLemonbarPP dbus = def { ppOutput = dbusOutput dbus - , ppCurrent = wrap "%{B#d33682}%{F-}" "%{B-}" +-- myLemonbarPP :: D.Client -> PP +-- myLemonbarPP dbus = def { ppOutput = dbusOutput dbus +myLemonbarPP = def { + ppCurrent = wrap "%{B#d33682}%{F-}" "%{B-}" , ppWsSep = "" - , ppHidden = wrap "%{F#02fc45}%{B#130F23}" "%{B-}%{f-}" + , ppHidden = wrap "%{F#02fc45}%{B#130F23}" "%{B-}%{f-}" , ppHiddenNoWindows = wrap "%{F#268bd2}" "%{F-}" , ppTitle = wrap " %{B#130F23}%{F#6c71c4} " " %{F-}%{B-}" . shorten 60 , ppUrgent = wrap "%{B#9cfc02} " " %{B-}%{F-}" , ppLayout = wrap "%{B#130F23}%{F#cb31d6} " " %{F-}%{B-}" --- , ppLayout = wrap "%{r}%{B#99B1D5}%{F#232627} " " %{B-} " - , ppSep = " " - -- , ppOrder = \(ws:l:t:ex) -> [ws]++[t]++[l]++["%{B#50FA7B}%{F#232627} WIN:"]++ex++["%{B-}%{F-} "] + , ppSep = " " , ppOrder = \(ws:l:t:ex) -> [ws]++[l]++[t]++ex - } + } -dbusOutput :: D.Client -> String -> IO () -dbusOutput dbus str = do - let signal = (D.signal objectPath interfaceName memberName) { - D.signalBody = [D.toVariant $ UTF8.decodeString str] - } - D.emit dbus signal - where - objectPath = D.objectPath_ "/org/xmonad/Log" - interfaceName = D.interfaceName_ "org.xmonad.Log" - memberName = D.memberName_ "Update" +-- dbusOutput :: D.Client -> String -> IO () +-- dbusOutput dbus str = do +-- let signal = (D.signal objectPath interfaceName memberName) { +-- D.signalBody = [D.toVariant $ UTF8.decodeString str] +-- } +-- D.emit dbus signal +-- where +-- objectPath = D.objectPath_ "/org/xmonad/Log" +-- interfaceName = D.interfaceName_ "org.xmonad.Log" +-- memberName = D.memberName_ "Update" @@ -396,10 +394,11 @@ dbusOutput dbus str = do main :: IO () main = do - dbus <- D.connectSession + notXMobar <- spawnPipe "lemonbar -p -b -g 800x21+0+0 -B '#171520' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'" + -- dbus <- D.connectSession -- Request access to the DBus name - D.requestName dbus (D.busName_ "org.xmonad.Log") - [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue] + -- D.requestName dbus (D.busName_ "org.xmonad.Log") + -- [D.nameAllowReplacement, D.nameReplaceExisting, D.nameDoNotQueue] xmonad $ docks def { terminal = myTerminal, @@ -413,8 +412,7 @@ main = do layoutHook = myLayoutHook, manageHook = namedScratchpadManageHook myScratchpads <+> fullscreenManageHook, handleEventHook = fullscreenEventHook, - logHook = dynamicLogWithPP (myLemonbarPP dbus), - - --logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x}, + -- logHook = dynamicLogWithPP (myLemonbarPP dbus), + logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x}, startupHook = myStartupHook } `additionalKeys` myKeys -- cgit v1.2.3