From af8f5bbc6d0cd2a69c968e6c824a29ddad695e73 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 10 Sep 2017 13:16:58 -0700 Subject: [PATCH] [taffybar] Get custom workspace names from "_NET_DESKTOP_FULL_NAMES" --- dotfiles/config/taffybar/taffybar | 2 +- dotfiles/config/taffybar/taffybar.hs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dotfiles/config/taffybar/taffybar b/dotfiles/config/taffybar/taffybar index 71900f6e..e7a5d009 160000 --- a/dotfiles/config/taffybar/taffybar +++ b/dotfiles/config/taffybar/taffybar @@ -1 +1 @@ -Subproject commit 71900f6e4f111360e31ce6d7d6b694274899f0af +Subproject commit e7a5d0092d823003880dc8337a931eeeb93555a9 diff --git a/dotfiles/config/taffybar/taffybar.hs b/dotfiles/config/taffybar/taffybar.hs index 29c3c43d..bfc10e35 100644 --- a/dotfiles/config/taffybar/taffybar.hs +++ b/dotfiles/config/taffybar/taffybar.hs @@ -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 =