Merge branch 'master' of github.com:IvanMalison/dotfiles

This commit is contained in:
2018-04-18 23:13:38 -07:00
9 changed files with 311 additions and 227 deletions

View File

@@ -18,10 +18,12 @@ executable imalison-taffybar
, containers
, directory
, filepath
, gtk-strut
, gi-gtk
, glib
, gtk3>=0.14.8
, gtk-sni-tray
, hslogger
, mtl
, haskell-gi-base
, process

View File

@@ -8,16 +8,10 @@ packages:
git: git@github.com:willdonnelly/dyre.git
commit: 11412752b483135e0c151ab90be17b217f837c4b
extra-dep: true
- location:
git: git@github.com:IvanMalison/gtk-traymanager.git
commit: 517b24722b2cdab2dadbafa882ffcb6b8a1d01ff
extra-dep: true
- location: ../xmonad/xmonad-contrib
extra-dep: true
- location: ../../../../Projects/status-notifier-item
extra-dep: true
- location: ../../../../Projects/haskell-dbus
extra-dep: true
- location: ../../../../Projects/gtk-sni-tray
extra-dep: true
- location:
@@ -27,19 +21,24 @@ packages:
- gtk
extra-dep: true
extra-deps:
- spool-0.1
- X11-xft-0.3.1
- gio-0.13.4.1
- 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
- dbus-1.0.0
- gi-dbusmenu-0.4.1
- gi-dbusmenugtk3-0.4.1
- gi-gdk-3.0.15
- gi-gdkpixbuf-2.0.15
- gi-gtk-3.0.21
- gi-gdkx11-3.0.2
- gi-gio-2.0.16
- gi-gtk-3.0.21
- gi-pango-1.0.16
resolver: lts-10.5
- gi-xlib-2.0.2
- gio-0.13.4.1
- gtk-strut-0.1.2.0
- gtk-traymanager-1.0.1
- libxml-sax-0.7.5
- rate-limit-1.1.1
- spool-0.1
- time-units-1.0.0
- xml-helpers-1.0.0
resolver: lts-11.4
allow-newer: true

View File

@@ -11,9 +11,10 @@ import Data.List
import Data.List.Split
import qualified Data.Map as M
import Data.Maybe
import Debug.Trace
import Foreign.ForeignPtr
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.Abstract.Widget as W
import qualified "gtk3" Graphics.UI.Gtk.Layout.Table as T
@@ -23,10 +24,13 @@ import System.Directory
import System.Environment
import System.FilePath.Posix
import System.Glib.GObject
import System.IO
import System.Information.CPU
import System.Information.EWMHDesktopInfo
import System.Information.Memory
import System.Information.X11DesktopInfo
import System.Log.Handler.Simple
import System.Log.Logger
import System.Process
import System.Taffybar
import System.Taffybar.Battery
@@ -34,14 +38,13 @@ import System.Taffybar.IconImages
import System.Taffybar.LayoutSwitcher
import System.Taffybar.MPRIS2
import System.Taffybar.NetMonitor
import System.Taffybar.Pager
import System.Taffybar.SimpleClock
import System.Taffybar.SimpleConfig
import System.Taffybar.Systray
import System.Taffybar.ToggleMonitor
import System.Taffybar.Widgets.PollingGraph
import System.Taffybar.WindowSwitcher
import System.Taffybar.WorkspaceHUD
import System.Taffybar.WorkspaceSwitcher
import Text.Printf
import Text.Read hiding (lift)
import Unsafe.Coerce
@@ -123,28 +126,6 @@ underlineWidget cfg buildWidget name = do
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), _) =
printf "%s: %s - %s" wsName (head $ splitOn "\NUL" wclass) wtitle
where
@@ -157,18 +138,28 @@ getInterfaces = do
addClass klass action = do
widget <- action
widgetSetClass widget klass
lift $ widgetSetClass widget klass
return widget
(buildWidgetCons, _) = mkWidget
buildSNITray = do
GI.Widget trayGIWidgetMP <- buildTrayWithHost
-- XXX: this won't work for multiple taffybars because it will attempt to
-- register a second host with a name that already exists on the dbus tray.
-- Need to take an approach similar to that of gtk-sni-tray to get that to
-- work.
GI.Widget trayGIWidgetMP <- buildTrayWithHost GI.OrientationHorizontal
wrapNewGObject mkWidget (castPtr <$> disownManagedPtr trayGIWidgetMP)
logDebug = do
handler <- streamHandler stdout DEBUG
logger <- getLogger "System.Taffybar"
saveGlobalLogger $ setLevel DEBUG logger
main = do
interfaceNames <- getInterfaces
homeDirectory <- getHomeDirectory
logDebug
let resourcesDirectory = homeDirectory </> ".lib" </> "resources"
inResourcesDirectory file = resourcesDirectory </> file
highContrastDirectory =
@@ -232,25 +223,29 @@ main = do
-- ]
, showWorkspaceFn = hideEmpty
, updateRateLimitMicroseconds = 100000
, updateOnWMIconChange = True
, debugMode = False
, labelSetter = workspaceNamesLabelSetter
}
netMonitor = netMonitorMultiNew 1.5 interfaceNames
pagerConfig =
defaultPagerConfig
{useImages = True, windowSwitcherFormatter = myFormatEntry}
-- makeUnderline = underlineWidget myHUDConfig
pgr <- pagerNew pagerConfig
-- pgr <- pagerNew pagerConfig
-- tray2 <- movableWidget tray
let hud = buildWorkspaceHUD myHUDConfig pgr
los = layoutSwitcherNew pgr
wnd = windowSwitcherNew pgr
taffyConfig =
defaultTaffybarConfig
let hud = buildWorkspaceHUD myHUDConfig
los = layoutSwitcherNew defaultLayoutSwitcherConfig
wnd = windowSwitcherNew defaultWindowSwitcherConfig
simpleTaffyConfig =
defaultSimpleTaffyConfig
{ startWidgets = [hud, los, addClass "WindowSwitcher" wnd]
, endWidgets =
[ batteryBarNewWithFormat defaultBatteryConfig "$percentage$% ($time$) - $status$" 1.0
||||||| merged common ancestors
, endWidgets =
[ batteryBarNew defaultBatteryConfig 1.0
=======
, centerWidgets = []
, endWidgets = map lift
[ batteryBarNew defaultBatteryConfig 1.0
>>>>>>> b44e57a9f4ec822e99649b1ccc5516cbcbad4fb8
, makeContents clock "Cpu"
-- , makeContents systrayNew "Cpu"
, makeContents buildSNITray "Cpu"
@@ -261,10 +256,10 @@ main = do
]
, barPosition = Top
, barPadding = 5
, barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig + 10)
, barHeight = (underlineHeight myHUDConfig + windowIconSize myHUDConfig + 15)
, widgetSpacing = 0
}
withToggleSupport taffyConfig
dyreTaffybar $ handleDBusToggles $ toTaffyConfig simpleTaffyConfig
-- Local Variables:
-- flycheck-ghc-args: ("-Wno-missing-signatures")

View File

@@ -1,134 +0,0 @@
style "taffybar-default" {
color["black"] = "#000000"
color["white"] = "#ffffff"
color["green"] = "#4caf50"
color["yellow"] = "#ffeb3b"
color["orange"] = "#f4511e"
color["blue"] = "#2196f3"
color["red"] = "#F44336"
color["dgrey"] = "#212121"
color["ldgrey"] = "#333333"
color["mgrey"] = "#808080"
color["lldgrey"] = "#424242"
color["lgrey"] = "#bdbdbd"
color["teal"] = "#00796b"
color["bgrey"] = "#37474F"
color["bgreyl"] = "#546E7A"
color["activeWS"] = @yellow
color["visibleWS"] = @red
color["base"] = @black
color["accent1"] = @dgrey
color["accent2"] = @ldgrey
bg[NORMAL] = @black
fg[NORMAL] = @white
text[NORMAL] = @black
fg[PRELIGHT] = @yellow
}
style "taffybar-active-window" = "taffybar-default" {
fg[NORMAL] = @white
}
style "taffybar-notification-button" = "taffybar-default" {
text[NORMAL] = @red
fg[NORMAL] = @red
}
style "taffybar-workspace-border-active" = "taffybar-default" {
bg[NORMAL] = @yellow
}
style "taffybar-workspace-border-visible" = "taffybar-default" {
bg[NORMAL] = @orange
}
style "taffybar-workspace-border-empty" = "taffybar-default" {
bg[NORMAL] = @blue
}
style "taffybar-workspace-border-hidden" = "taffybar-default" {
bg[NORMAL] = @blue
}
style "taffybar-icon-urgent" = "taffybar-default" {
bg[NORMAL] = @yellow
}
style "taffybar-icon-active" = "taffybar-default" {
bg[NORMAL] = @teal
}
style "taffybar-icon-minimized" = "taffybar-default" {
bg[NORMAL] = @red
}
style "taffybar-workspace-contents-active" = "taffybar-default" {
bg[NORMAL] = @dgrey
}
style "taffybar-workspace-contents-visible" = "taffybar-default" {
bg[NORMAL] = @black
}
style "taffybar-hover-button" = "taffybar-default" {
bg[ACTIVE] = @yellow
bg[NORMAL] = @black
bg[PRELIGHT] = @yellow
text[PRELIGHT] = @yellow
}
style "blue" = "taffybar-default" {
bg[NORMAL]= @blue
}
style "orange" = "taffybar-default" {
bg[NORMAL]= @orange
}
style "red" = "taffybar-default" {
bg[NORMAL]= @red
}
style "yellow" = "taffybar-default" {
bg[NORMAL]= @yellow
}
style "green" = "taffybar-default" {
bg[NORMAL]= @green
}
style "teal" = "taffybar-default" {
bg[NORMAL]= @teal
}
style "bgrey" = "taffybar-default" {
bg[NORMAL]= @bgrey
}
widget "Taffybar*" style "taffybar-default"
widget "*WindowTitle*" style "taffybar-active-window"
widget "*NotificationCloseButton" style "taffybar-notification-button"
widget "*Workspace-underline*-active*" style "taffybar-workspace-border-active"
widget "*Workspace-contents*-active*" style "taffybar-workspace-contents-active"
widget "*Workspace-contents*-visible*" style "taffybar-workspace-contents-visible"
widget "*Workspace-underline*-visible*" style "taffybar-workspace-border-visible"
widget "*Workspace-underline*-empty*" style "taffybar-workspace-border-empty"
widget "*Workspace-underline*-hidden*" style "taffybar-workspace-border-hidden"
widget "*Workspace-Border*-active*" style "taffybar-workspace-border-active"
widget "*Workspace-Container-*-active*" style "taffybar-default"
widget "*Workspace-Border*-visible*" style "taffybar-workspace-border-visible"
widget "*Workspace-Container-*-visible*" style "taffybar-default"
widget "*Workspace-icon*-urgent*" style "taffybar-icon-urgent"
widget "*Workspace-icon*-active*" style "taffybar-icon-active"
widget "*Workspace-icon*-minimized*" style "taffybar-icon-minimized"
widget "*WorkspaceHUD-*" style "taffybar-hover-button"
widget "*WorkspaceHUD-*" style "taffybar-hover-button"
widget "*clock-underline*" style "taffybar-workspace-border-active"
widget "*tray-underline*" style "taffybar-workspace-border-hidden"
widget "*blue-underline*" style "blue"
widget "*red-underline*" style "red"
widget "*yellow-underline*" style "yellow"
widget "*orange-underline*" style "orange"
widget "*green-underline*" style "green"
widget "*teal-underline*" style "teal"
widget "*bgrey-underline*" style "bgrey"