[taffybar] Adapt to new gtk-sni-tray interface

This commit is contained in:
Ivan Malison 2018-04-07 12:19:11 -07:00
parent 1b4ea820a0
commit dd7eeb6744
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8
2 changed files with 4 additions and 27 deletions

@ -1 +1 @@
Subproject commit f7673d90530183aa97d86000dc3160ca784fa492 Subproject commit 7308a20132c789eedadde06a7742359e19c8f8f2

View File

@ -13,7 +13,7 @@ import qualified Data.Map as M
import Data.Maybe import Data.Maybe
import Foreign.ForeignPtr import Foreign.ForeignPtr
import Foreign.Ptr import Foreign.Ptr
import qualified GI.Gtk.Objects.Widget as GI import qualified GI.Gtk as GI
import qualified "gtk3" Graphics.UI.Gtk as Gtk import qualified "gtk3" Graphics.UI.Gtk as Gtk
import qualified "gtk3" Graphics.UI.Gtk.Abstract.Widget as W import qualified "gtk3" Graphics.UI.Gtk.Abstract.Widget as W
import qualified "gtk3" Graphics.UI.Gtk.Layout.Table as T import qualified "gtk3" Graphics.UI.Gtk.Layout.Table as T
@ -41,7 +41,6 @@ import System.Taffybar.ToggleMonitor
import System.Taffybar.Widgets.PollingGraph import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WindowSwitcher import System.Taffybar.WindowSwitcher
import System.Taffybar.WorkspaceHUD import System.Taffybar.WorkspaceHUD
import System.Taffybar.WorkspaceSwitcher
import Text.Printf import Text.Printf
import Text.Read hiding (lift) import Text.Read hiding (lift)
import Unsafe.Coerce import Unsafe.Coerce
@ -123,28 +122,6 @@ underlineWidget cfg buildWidget name = do
return $ Gtk.toWidget t return $ Gtk.toWidget t
movableWidget builder =
do
-- Delay creation of the widget or else failure from trying to get screen
widVar <- MV.newEmptyMVar
let moveWidget = do
isEmpty <- MV.isEmptyMVar widVar
when isEmpty $
do
putwid <- builder
MV.putMVar widVar putwid
wid <- MV.readMVar widVar
hbox <- Gtk.hBoxNew False 0
parent <- Gtk.widgetGetParent wid
if isJust parent
then
Gtk.widgetReparent wid hbox
else
Gtk.containerAdd hbox wid
Gtk.widgetShowAll hbox
return $ Gtk.toWidget hbox
return moveWidget
myFormatEntry wsNames ((ws, wtitle, wclass), _) = myFormatEntry wsNames ((ws, wtitle, wclass), _) =
printf "%s: %s - %s" wsName (head $ splitOn "\NUL" wclass) wtitle printf "%s: %s - %s" wsName (head $ splitOn "\NUL" wclass) wtitle
where where
@ -163,7 +140,7 @@ addClass klass action = do
(buildWidgetCons, _) = mkWidget (buildWidgetCons, _) = mkWidget
buildSNITray = do buildSNITray = do
GI.Widget trayGIWidgetMP <- buildTrayWithHost GI.Widget trayGIWidgetMP <- buildTrayWithHost GI.OrientationHorizontal
wrapNewGObject mkWidget (castPtr <$> disownManagedPtr trayGIWidgetMP) wrapNewGObject mkWidget (castPtr <$> disownManagedPtr trayGIWidgetMP)
main = do main = do
@ -261,7 +238,7 @@ main = do
] ]
, barPosition = Top , barPosition = Top
, barPadding = 5 , barPadding = 5
, barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig + 10) , barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig + 15)
, widgetSpacing = 0 , widgetSpacing = 0
} }
withToggleSupport taffyConfig withToggleSupport taffyConfig