[taffybar] Get custom workspace names from "_NET_DESKTOP_FULL_NAMES"
This commit is contained in:
parent
aba5a832f2
commit
af8f5bbc6d
@ -1 +1 @@
|
|||||||
Subproject commit 71900f6e4f111360e31ce6d7d6b694274899f0af
|
Subproject commit e7a5d0092d823003880dc8337a931eeeb93555a9
|
@ -16,6 +16,7 @@ import System.FilePath.Posix
|
|||||||
import System.Information.CPU
|
import System.Information.CPU
|
||||||
import System.Information.EWMHDesktopInfo
|
import System.Information.EWMHDesktopInfo
|
||||||
import System.Information.Memory
|
import System.Information.Memory
|
||||||
|
import System.Information.X11DesktopInfo
|
||||||
import System.Process
|
import System.Process
|
||||||
import System.Taffybar
|
import System.Taffybar
|
||||||
import System.Taffybar.LayoutSwitcher
|
import System.Taffybar.LayoutSwitcher
|
||||||
@ -45,6 +46,14 @@ memCallback widget = do
|
|||||||
return ()
|
return ()
|
||||||
return [memoryUsedRatio mi]
|
return [memoryUsedRatio mi]
|
||||||
|
|
||||||
|
getFullWorkspaceNames :: X11Property [(WorkspaceIdx, String)]
|
||||||
|
getFullWorkspaceNames = go <$> readAsListOfString Nothing "_NET_DESKTOP_FULL_NAMES"
|
||||||
|
where go = zip [WSIdx i | i <- [0..]]
|
||||||
|
|
||||||
|
workspaceNamesLabelSetter workspace = do
|
||||||
|
fullNames <- liftX11 getFullWorkspaceNames
|
||||||
|
return $ fromMaybe "" $ lookup (workspaceIdx workspace) fullNames
|
||||||
|
|
||||||
mem :: IO Gtk.Widget
|
mem :: IO Gtk.Widget
|
||||||
mem = do
|
mem = do
|
||||||
ebox <- Gtk.eventBoxNew
|
ebox <- Gtk.eventBoxNew
|
||||||
@ -168,6 +177,7 @@ main = do
|
|||||||
, redrawIconsOnStateChange = True
|
, redrawIconsOnStateChange = True
|
||||||
, innerPadding = 5
|
, innerPadding = 5
|
||||||
, outerPadding = 5
|
, outerPadding = 5
|
||||||
|
, labelSetter = workspaceNamesLabelSetter
|
||||||
}
|
}
|
||||||
netMonitor = netMonitorMultiNew 1.5 interfaceNames
|
netMonitor = netMonitorMultiNew 1.5 interfaceNames
|
||||||
pagerConfig =
|
pagerConfig =
|
||||||
|
Loading…
Reference in New Issue
Block a user