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