aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--XMonad/xmonad.hs45
1 files changed, 36 insertions, 9 deletions
diff --git a/XMonad/xmonad.hs b/XMonad/xmonad.hs
index ce2495d8..e6f8e2f4 100644
--- a/XMonad/xmonad.hs
+++ b/XMonad/xmonad.hs
@@ -2,6 +2,11 @@ import XMonad
import qualified XMonad.StackSet as W
import XMonad.ManageHook
+-- xmonad-log imports
+import qualified DBus as D
+import qualified DBus.Client as D
+import qualified Codec.Binary.UTF8.String as UTF8
+
-- data
import Data.Tree
import qualified Data.Map as M
@@ -50,13 +55,10 @@ import XMonad.Util.Paste
import XMonad.Util.Run
import XMonad.Util.NamedScratchpad
+
myStartupHook :: X ()
myStartupHook = do
--spawnOnce "/home/zt/.xmonad/baraction | lemonbar -b -g 500x21+800+0 -B '#171520' -F '#ffffff' -f 'Source Han Sans JP:size=10'"
--- spawnOnce "nitrogen --restore"
--- spawnOnce "startpage-server"
--- spawnOnce "picom"
--- spawnOnce "deadd-notification-center"
spawnOnce "brave"
-- spawnOnce "sleep 3; trayer --align center --edge top --width 20 --height 21 --expand true --distance 90 --distancefrom right --tint 0x171520 --transparent true --alpha 0 --iconspacing 8"
setWMName "Oppai"
@@ -367,7 +369,8 @@ myLayoutHook = avoidStruts (
||| tabbedRight shrinkText def
)
-myLemonbarPP = def {ppCurrent = wrap "%{B#d33682}" "%{B-}"
+myLemonbarPP :: D.Client -> PP
+myLemonbarPP dbus = def {ppCurrent = wrap "%{B#d33682}" "%{B-}"
, ppWsSep = ""
, ppHidden = wrap "%{B#268bd2}" "%{B-}"
, ppHiddenNoWindows = wrap "%{F#02fc45}" "%{F-}"
@@ -377,12 +380,34 @@ myLemonbarPP = def {ppCurrent = wrap "%{B#d33682}" "%{B-}"
, ppSep = " "
, ppExtras = [windowCount]
, ppOrder = \(ws:l:t:ex) -> [ws]++[t]++[l]++["%{B#50FA7B}%{F#232627} WIN:"]++ex++["%{B-}%{F-} "]
+ , ppOutput = dbusOutput dbus
}
+-- Emit a DBus signal on log updates
+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"
+
+
+
+
+
+main :: IO ()
main = do
- notXMobar <- spawnPipe "lemonbar -b -g 1366x21+0+0 -B '#130F23' -F '#ffffff' -f 'Source Han Sans JP:size=10' -o -3 -f 'RobotoMono Nerd Font:style=Regular:size=15' -f -n 'notXMobar' -o 0"
- statusBar <- spawnPipe "/home/zt/.xmonad/baraction | lemonbar -g 1366x21+0+0 -B '#130F23' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'"
- statusBar <- spawnPipe "tiramisu -j | lemonbar -g 1366x21+0+0 -B '#130F23' -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]
+ -- notXMobar <- spawnPipe "lemonbar -b -g 1366x21+0+0 -B '#130F23' -F '#ffffff' -f 'Source Han Sans JP:size=10' -o -3 -f 'RobotoMono Nerd Font:style=Regular:size=15' -f -n 'notXMobar' -o 0"
+ -- statusBar <- spawnPipe "/home/zt/.xmonad/baraction | lemonbar -g 1366x21+0+0 -B '#130F23' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'"
+ -- statusBar <- spawnPipe "tiramisu -j | lemonbar -g 850x21+0+0 -B '#130F23' -F '#ffffff' -o -3 -f 'Source Han Sans JP:size=10' -o 0 -f 'RobotoMono Nerd Font:style=Regular:size=15'"
xmonad $ docks def
{
terminal = myTerminal,
@@ -396,6 +421,8 @@ main = do
layoutHook = myLayoutHook,
manageHook = namedScratchpadManageHook myScratchpads <+> fullscreenManageHook,
handleEventHook = fullscreenEventHook,
- logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x},
+ logHook = dynamicLogWithPP (myLemonbarPP dbus),
+
+ --logHook = dynamicLogWithPP myLemonbarPP { ppOutput = \x -> hPutStrLn notXMobar x},
startupHook = myStartupHook
} `additionalKeys` myKeys