[taffybar] Get custom workspace names from "_NET_DESKTOP_FULL_NAMES"

This commit is contained in:
Ivan Malison 2017-09-10 13:16:58 -07:00
parent aba5a832f2
commit af8f5bbc6d
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 11 additions and 1 deletions

@ -1 +1 @@
Subproject commit 71900f6e4f111360e31ce6d7d6b694274899f0af
Subproject commit e7a5d0092d823003880dc8337a931eeeb93555a9

View File

@ -16,6 +16,7 @@ import System.FilePath.Posix
import System.Information.CPU
import System.Information.EWMHDesktopInfo
import System.Information.Memory
import System.Information.X11DesktopInfo
import System.Process
import System.Taffybar
import System.Taffybar.LayoutSwitcher
@ -45,6 +46,14 @@ memCallback widget = do
return ()
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 = do
ebox <- Gtk.eventBoxNew
@ -168,6 +177,7 @@ main = do
, redrawIconsOnStateChange = True
, innerPadding = 5
, outerPadding = 5
, labelSetter = workspaceNamesLabelSetter
}
netMonitor = netMonitorMultiNew 1.5 interfaceNames
pagerConfig =