[taffybar] Get custom workspace names from "_NET_DESKTOP_FULL_NAMES"

This commit is contained in:
2017-09-10 13:16:58 -07:00
parent aba5a832f2
commit af8f5bbc6d
2 changed files with 11 additions and 1 deletions

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 =