forked from colonelpanic/dotfiles
[taffybar] Use sni tray
This commit is contained in:
parent
a55c88fc9a
commit
db2ad6f48d
@ -18,9 +18,12 @@ executable imalison-taffybar
|
||||
, containers
|
||||
, directory
|
||||
, filepath
|
||||
, gtk3
|
||||
, gtk-traymanager>=1.0.0
|
||||
, gi-gtk
|
||||
, glib
|
||||
, gtk3>=0.14.8
|
||||
, gtk-sni-tray
|
||||
, mtl
|
||||
, haskell-gi-base
|
||||
, process
|
||||
, split
|
||||
, taffybar
|
||||
|
@ -18,13 +18,24 @@ packages:
|
||||
extra-dep: true
|
||||
- location: ../../../../Projects/haskell-dbus
|
||||
extra-dep: true
|
||||
- location: ../../../../Projects/gtk-sni-tray
|
||||
extra-dep: true
|
||||
- location: ./gtk2hs/gtk
|
||||
extra-dep: true
|
||||
extra-deps:
|
||||
- spool-0.1
|
||||
- X11-xft-0.3.1
|
||||
- gio-0.13.4.1
|
||||
- gtk3-0.14.8
|
||||
- libxml-sax-0.7.5
|
||||
- rate-limit-1.1.1
|
||||
- time-units-1.0.0
|
||||
- xml-helpers-1.0.0
|
||||
- gi-dbusmenugtk3-0.4.1
|
||||
- gi-dbusmenu-0.4.1
|
||||
- gi-gdk-3.0.15
|
||||
- gi-gdkpixbuf-2.0.15
|
||||
- gi-gtk-3.0.21
|
||||
- gi-gio-2.0.16
|
||||
- gi-pango-1.0.16
|
||||
resolver: lts-10.5
|
||||
allow-newer: true
|
||||
|
@ -45,14 +45,29 @@
|
||||
|
||||
.IconImage {
|
||||
transition: opacity .5s;
|
||||
padding: 2px;
|
||||
padding: 0px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#WindowSwitcher, #Taffybar_WindowSwitcher {
|
||||
.WindowSwitcher * {
|
||||
background-color: @bg-color;
|
||||
}
|
||||
|
||||
.TrayContainer {
|
||||
background-color: @urgent-window-color;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.TrayWidget {
|
||||
background-color: @urgent-window-color;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.TrayWidgetContainer {
|
||||
background-color: @urgent-window-color;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.Taffybar {
|
||||
background-color: @bg-color;
|
||||
border-radius: 5px;
|
||||
|
@ -5,16 +5,24 @@ import qualified Control.Concurrent.MVar as MV
|
||||
import Control.Exception.Base
|
||||
import Control.Monad
|
||||
import Control.Monad.Reader
|
||||
import Data.GI.Base
|
||||
import Data.GI.Base.ManagedPtr
|
||||
import Data.List
|
||||
import Data.List.Split
|
||||
import qualified Data.Map as M
|
||||
import Data.Maybe
|
||||
import Foreign.ForeignPtr
|
||||
import Foreign.Ptr
|
||||
import qualified GI.Gtk.Objects.Widget as GI
|
||||
import qualified "gtk3" Graphics.UI.Gtk as Gtk
|
||||
import qualified "gtk3" Graphics.UI.Gtk.Abstract.Widget as W
|
||||
import qualified "gtk3" Graphics.UI.Gtk.Layout.Table as T
|
||||
import Graphics.UI.Gtk.Types
|
||||
import StatusNotifier.Tray
|
||||
import System.Directory
|
||||
import System.Environment
|
||||
import System.FilePath.Posix
|
||||
import System.Glib.GObject
|
||||
import System.Information.CPU
|
||||
import System.Information.EWMHDesktopInfo
|
||||
import System.Information.Memory
|
||||
@ -31,12 +39,12 @@ import System.Taffybar.SimpleClock
|
||||
import System.Taffybar.Systray
|
||||
import System.Taffybar.ToggleMonitor
|
||||
import System.Taffybar.Widgets.PollingGraph
|
||||
import System.Taffybar.Widgets.StatusNotifierTray
|
||||
import System.Taffybar.WindowSwitcher
|
||||
import System.Taffybar.WorkspaceHUD
|
||||
import System.Taffybar.WorkspaceSwitcher
|
||||
import Text.Printf
|
||||
import Text.Read hiding (get, lift)
|
||||
import Text.Read hiding (lift)
|
||||
import Unsafe.Coerce
|
||||
|
||||
data ConstantIconController = ConstantIconController { cicImage :: Gtk.Image }
|
||||
|
||||
@ -76,9 +84,9 @@ getFullWorkspaceNames :: X11Property [(WorkspaceIdx, String)]
|
||||
getFullWorkspaceNames = go <$> readAsListOfString Nothing "_NET_DESKTOP_FULL_NAMES"
|
||||
where go = zip [WSIdx i | i <- [0..]]
|
||||
|
||||
workspaceNamesLabelSetter workspace = do
|
||||
fullNames <- liftX11Def [] getFullWorkspaceNames
|
||||
return $ fromMaybe "" $ lookup (workspaceIdx workspace) fullNames
|
||||
workspaceNamesLabelSetter workspace =
|
||||
fromMaybe "" . lookup (workspaceIdx workspace) <$>
|
||||
liftX11Def [] getFullWorkspaceNames
|
||||
|
||||
-- mem :: IO Gtk.Widget
|
||||
-- mem = do
|
||||
@ -147,6 +155,17 @@ getInterfaces = do
|
||||
(_, output, _) <- readCreateProcessWithExitCode (shell "list_interfaces.sh") ""
|
||||
return $ splitOn "\n" output
|
||||
|
||||
addClass klass action = do
|
||||
widget <- action
|
||||
widgetSetClass widget klass
|
||||
return widget
|
||||
|
||||
(buildWidgetCons, _) = mkWidget
|
||||
|
||||
buildSNITray = do
|
||||
GI.Widget trayGIWidgetMP <- buildTrayWithHost
|
||||
wrapNewGObject mkWidget (castPtr <$> disownManagedPtr trayGIWidgetMP)
|
||||
|
||||
main = do
|
||||
interfaceNames <- getInterfaces
|
||||
homeDirectory <- getHomeDirectory
|
||||
@ -229,20 +248,20 @@ main = do
|
||||
wnd = windowSwitcherNew pgr
|
||||
taffyConfig =
|
||||
defaultTaffybarConfig
|
||||
{ startWidgets = [hud, los, wnd]
|
||||
{ startWidgets = [hud, los, addClass "WindowSwitcher" wnd]
|
||||
, endWidgets =
|
||||
[ batteryBarNew defaultBatteryConfig 1.0
|
||||
, makeContents clock "Cpu"
|
||||
, makeContents systrayNew "Cpu"
|
||||
, makeContents buildTray "Cpu"
|
||||
-- , makeContents systrayNew "Cpu"
|
||||
, makeContents buildSNITray "Cpu"
|
||||
, makeContents cpu "Cpu"
|
||||
, makeContents mem "Cpu"
|
||||
, makeContents netMonitor "Cpu"
|
||||
, makeContents (join $ containerAddReturn <$> Gtk.eventBoxNew <*> mpris) "Cpu"
|
||||
]
|
||||
, barPosition = Top
|
||||
, barPadding = 10
|
||||
, barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig) + 15
|
||||
, barPadding = 5
|
||||
, barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig + 10)
|
||||
, widgetSpacing = 0
|
||||
}
|
||||
withToggleSupport taffyConfig
|
||||
|
Loading…
Reference in New Issue
Block a user