diff options
22 files changed, 549 insertions, 246 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 55cb1743..e94c0e8c 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
| @@ -178,6 +178,11 @@ in { | |||
| 178 | grab | 178 | grab |
| 179 | ''; | 179 | ''; |
| 180 | }; | 180 | }; |
| 181 | taffybar = { | ||
| 182 | enable = true; | ||
| 183 | package = import ./taffybar { inherit (pkgs) haskellPackages; }; | ||
| 184 | }; | ||
| 185 | status-notifier-watcher.enable = true; | ||
| 181 | pasystray.enable = true; | 186 | pasystray.enable = true; |
| 182 | udiskie = { | 187 | udiskie = { |
| 183 | enable = true; | 188 | enable = true; |
| @@ -255,14 +260,15 @@ in { | |||
| 255 | 260 | ||
| 256 | home = { | 261 | home = { |
| 257 | packages = with pkgs; [ | 262 | packages = with pkgs; [ |
| 258 | fira-code powerline-fonts nerdfonts pavucontrol keepassxc | 263 | fira fira-code powerline-fonts nerdfonts pavucontrol keepassxc |
| 259 | sxiv xclip mumble pulseaudio-ctl libnotify synergy | 264 | sxiv xclip mumble pulseaudio-ctl libnotify synergy |
| 260 | xorg.xbacklight screen-message pidgin-with-plugins | 265 | xorg.xbacklight screen-message pidgin-with-plugins |
| 261 | google-play-music-desktop-player qt5ct playerctl evince | 266 | google-play-music-desktop-player qt5ct playerctl evince |
| 262 | thunderbird wrappedZulip zoom-us steam steam-run wireshark skype | 267 | thunderbird wrappedZulip zoom-us steam steam-run wireshark |
| 263 | virt-manager rclone cached-nix-shell xournal discord xmonad | 268 | skype virt-manager rclone cached-nix-shell xournal discord |
| 264 | worktime fira-code-symbols emacsclientDesktopItem libreoffice | 269 | xmonad worktime fira-code-symbols emacsclientDesktopItem |
| 265 | xournalpp wrappedChrome nixos-shell virt-viewer freerdp | 270 | libreoffice xournalpp wrappedChrome nixos-shell virt-viewer |
| 271 | freerdp | ||
| 266 | ]; | 272 | ]; |
| 267 | 273 | ||
| 268 | file = { | 274 | file = { |
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index 7faef31a..56965b74 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
| @@ -16,28 +16,33 @@ in { | |||
| 16 | After = ["graphical-session-pre.target"]; | 16 | After = ["graphical-session-pre.target"]; |
| 17 | }; | 17 | }; |
| 18 | }; | 18 | }; |
| 19 | trayer = { | 19 | # trayer = { |
| 20 | Service = { | 20 | # Service = { |
| 21 | Type = "simple"; | 21 | # Type = "simple"; |
| 22 | WorkingDirectory = "~"; | 22 | # WorkingDirectory = "~"; |
| 23 | ExecStart = "${pkgs.trayer}/bin/trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 8 --tint 0x000000 --alpha 0 --transparent true --height 32 --monitor primary"; | 23 | # ExecStart = "${pkgs.trayer}/bin/trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 8 --tint 0x000000 --alpha 0 --transparent true --height 32 --monitor primary"; |
| 24 | Restart = "always"; | 24 | # Restart = "always"; |
| 25 | }; | 25 | # }; |
| 26 | Install = { | 26 | # Install = { |
| 27 | WantedBy = ["graphical-session.target"]; | 27 | # WantedBy = ["graphical-session.target"]; |
| 28 | }; | 28 | # }; |
| 29 | }; | 29 | # }; |
| 30 | xmobar = { | 30 | # xmobar = { |
| 31 | Service = { | 31 | # Service = { |
| 32 | Type = "simple"; | 32 | # Type = "simple"; |
| 33 | WorkingDirectory = "~"; | 33 | # WorkingDirectory = "~"; |
| 34 | ExecStart = "${xmobar}/bin/xmobar"; | 34 | # ExecStart = "${xmobar}/bin/xmobar"; |
| 35 | Restart = "always"; | 35 | # Restart = "always"; |
| 36 | Environment = "PATH=${pkgs.worktime}/bin:${pkgs.openssh}/bin"; | 36 | # Environment = "PATH=${pkgs.worktime}/bin:${pkgs.openssh}/bin"; |
| 37 | 37 | ||
| 38 | }; | 38 | # }; |
| 39 | Install = { | 39 | # Install = { |
| 40 | WantedBy = ["graphical-session.target"]; | 40 | # WantedBy = ["graphical-session.target"]; |
| 41 | # }; | ||
| 42 | # }; | ||
| 43 | taffybar = { | ||
| 44 | Service = { | ||
| 45 | Environment = with pkgs; "PATH=${worktime}/bin:${systemd}/bin"; | ||
| 41 | }; | 46 | }; |
| 42 | }; | 47 | }; |
| 43 | dunst = { | 48 | dunst = { |
diff --git a/accounts/gkleen@sif/taffybar/default.nix b/accounts/gkleen@sif/taffybar/default.nix new file mode 100644 index 00000000..98366d8f --- /dev/null +++ b/accounts/gkleen@sif/taffybar/default.nix | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | { haskellPackages ? (import <nixpkgs> {}).haskellPackages }: | ||
| 2 | haskellPackages.callCabal2nix "gkleen-sif-taffybar" ./. {} | ||
diff --git a/accounts/gkleen@sif/taffybar/gkleen-sif-taffybar.cabal b/accounts/gkleen@sif/taffybar/gkleen-sif-taffybar.cabal new file mode 100644 index 00000000..7f56dece --- /dev/null +++ b/accounts/gkleen@sif/taffybar/gkleen-sif-taffybar.cabal | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | name: gkleen-sif-taffybar | ||
| 2 | version: 0.0.0 | ||
| 3 | build-type: Simple | ||
| 4 | cabal-version: >=1.10 | ||
| 5 | |||
| 6 | data-files: taffybar.css | ||
| 7 | |||
| 8 | executable taffybar | ||
| 9 | hs-source-dirs: src | ||
| 10 | main-is: taffybar.hs | ||
| 11 | ghc-options: -threaded -rtsopts -with-rtsopts=-N -O2 -Wall | ||
| 12 | build-depends: base | ||
| 13 | , containers | ||
| 14 | , directory | ||
| 15 | , filepath | ||
| 16 | , gtk3 | ||
| 17 | , taffybar | ||
| 18 | , X11>=1.8 | ||
| 19 | , transformers | ||
| 20 | , gi-gtk | ||
| 21 | , time, time-locale-compat | ||
| 22 | , text | ||
| 23 | , HStringTemplate | ||
| 24 | , gtk-sni-tray | ||
| 25 | other-modules: Paths_gkleen_sif_taffybar | ||
| 26 | , System.Taffybar.Widget.Clock | ||
| 27 | , System.Taffybar.Widget.TooltipBattery | ||
| 28 | default-language: Haskell2010 | ||
| 29 | default-extensions: ScopedTypeVariables | ||
| 30 | , LambdaCase | ||
| 31 | , NamedFieldPuns \ No newline at end of file | ||
diff --git a/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/Clock.hs b/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/Clock.hs new file mode 100644 index 00000000..e8dc480f --- /dev/null +++ b/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/Clock.hs | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | {-# LANGUAGE OverloadedStrings #-} | ||
| 2 | module System.Taffybar.Widget.Clock | ||
| 3 | ( textClockNew | ||
| 4 | , textClockNewWith | ||
| 5 | , defaultClockConfig | ||
| 6 | , ClockConfig(..) | ||
| 7 | , ClockUpdateStrategy(..) | ||
| 8 | ) where | ||
| 9 | |||
| 10 | import Control.Monad.IO.Class | ||
| 11 | import Data.Maybe | ||
| 12 | import qualified Data.Text as T | ||
| 13 | import qualified Data.Time.Clock as Clock | ||
| 14 | import Data.Time.Format | ||
| 15 | import Data.Time.LocalTime | ||
| 16 | import qualified Data.Time.Locale.Compat as L | ||
| 17 | import GI.Gtk | ||
| 18 | import System.Taffybar.Widget.Generic.PollingLabel | ||
| 19 | |||
| 20 | type ClockFormat = L.TimeLocale -> ZonedTime -> T.Text | ||
| 21 | |||
| 22 | -- | Create the widget. I recommend passing @Nothing@ for the TimeLocale | ||
| 23 | -- parameter. The format string can include Pango markup | ||
| 24 | -- (<http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>). | ||
| 25 | textClockNew :: | ||
| 26 | MonadIO m => Maybe L.TimeLocale -> ClockFormat -> Double -> m GI.Gtk.Widget | ||
| 27 | textClockNew userLocale format interval = | ||
| 28 | textClockNewWith cfg | ||
| 29 | where | ||
| 30 | cfg = defaultClockConfig { clockTimeLocale = userLocale | ||
| 31 | , clockFormat = format | ||
| 32 | , clockUpdateStrategy = ConstantInterval interval | ||
| 33 | } | ||
| 34 | |||
| 35 | data ClockUpdateStrategy | ||
| 36 | = ConstantInterval Double | ||
| 37 | | RoundedTargetInterval Int Double | ||
| 38 | deriving (Eq, Ord, Show) | ||
| 39 | |||
| 40 | data ClockConfig = ClockConfig | ||
| 41 | { clockTimeZone :: Maybe TimeZone | ||
| 42 | , clockTimeLocale :: Maybe L.TimeLocale | ||
| 43 | , clockFormat :: ClockFormat | ||
| 44 | , clockUpdateStrategy :: ClockUpdateStrategy | ||
| 45 | } | ||
| 46 | |||
| 47 | -- | A clock configuration that defaults to the current locale | ||
| 48 | defaultClockConfig :: ClockConfig | ||
| 49 | defaultClockConfig = ClockConfig | ||
| 50 | { clockTimeZone = Nothing | ||
| 51 | , clockTimeLocale = Nothing | ||
| 52 | , clockFormat = \locale zonedTime -> T.pack $ formatTime locale "%a %b %_d %r" zonedTime | ||
| 53 | , clockUpdateStrategy = RoundedTargetInterval 5 0.0 | ||
| 54 | } | ||
| 55 | |||
| 56 | systemGetTZ :: IO TimeZone | ||
| 57 | systemGetTZ = getCurrentTimeZone | ||
| 58 | |||
| 59 | -- | A configurable text-based clock widget. It currently allows for | ||
| 60 | -- a configurable time zone through the 'ClockConfig'. | ||
| 61 | -- | ||
| 62 | -- See also 'textClockNew'. | ||
| 63 | textClockNewWith :: MonadIO m => ClockConfig -> m Widget | ||
| 64 | textClockNewWith ClockConfig | ||
| 65 | { clockTimeZone = userZone | ||
| 66 | , clockTimeLocale = userLocale | ||
| 67 | , clockFormat = format | ||
| 68 | , clockUpdateStrategy = updateStrategy | ||
| 69 | } = liftIO $ do | ||
| 70 | let getTZ = maybe systemGetTZ return userZone | ||
| 71 | locale = fromMaybe L.defaultTimeLocale userLocale | ||
| 72 | |||
| 73 | let getUserZonedTime = | ||
| 74 | utcToZonedTime <$> getTZ <*> Clock.getCurrentTime | ||
| 75 | |||
| 76 | doTimeFormat = format locale | ||
| 77 | |||
| 78 | getRoundedTimeAndNextTarget = do | ||
| 79 | zonedTime <- getUserZonedTime | ||
| 80 | return $ case updateStrategy of | ||
| 81 | ConstantInterval interval -> | ||
| 82 | (doTimeFormat zonedTime, Nothing, interval) | ||
| 83 | RoundedTargetInterval roundSeconds offset -> | ||
| 84 | let roundSecondsDiffTime = fromIntegral roundSeconds | ||
| 85 | addTheRound = addLocalTime roundSecondsDiffTime | ||
| 86 | localTime = zonedTimeToLocalTime zonedTime | ||
| 87 | ourLocalTimeOfDay = localTimeOfDay localTime | ||
| 88 | seconds = round $ todSec ourLocalTimeOfDay | ||
| 89 | secondsFactor = seconds `div` roundSeconds | ||
| 90 | displaySeconds = secondsFactor * roundSeconds | ||
| 91 | baseLocalTimeOfDay = | ||
| 92 | ourLocalTimeOfDay { todSec = fromIntegral displaySeconds } | ||
| 93 | ourLocalTime = | ||
| 94 | localTime { localTimeOfDay = baseLocalTimeOfDay } | ||
| 95 | roundedLocalTime = | ||
| 96 | if seconds `mod` roundSeconds > roundSeconds `div` 2 | ||
| 97 | then addTheRound ourLocalTime | ||
| 98 | else ourLocalTime | ||
| 99 | roundedZonedTime = | ||
| 100 | zonedTime { zonedTimeToLocalTime = roundedLocalTime } | ||
| 101 | nextTarget = addTheRound ourLocalTime | ||
| 102 | amountToWait = realToFrac $ diffLocalTime nextTarget localTime | ||
| 103 | in (doTimeFormat roundedZonedTime, Nothing, amountToWait - offset) | ||
| 104 | |||
| 105 | label <- pollingLabelWithVariableDelay getRoundedTimeAndNextTarget | ||
| 106 | ebox <- eventBoxNew | ||
| 107 | containerAdd ebox label | ||
| 108 | eventBoxSetVisibleWindow ebox False | ||
| 109 | widgetShowAll ebox | ||
| 110 | toWidget ebox | ||
| 111 | |||
diff --git a/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/TooltipBattery.hs b/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/TooltipBattery.hs new file mode 100644 index 00000000..9dc52774 --- /dev/null +++ b/accounts/gkleen@sif/taffybar/src/System/Taffybar/Widget/TooltipBattery.hs | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | {-# LANGUAGE OverloadedStrings #-} | ||
| 2 | {-# LANGUAGE ScopedTypeVariables #-} | ||
| 3 | module System.Taffybar.Widget.TooltipBattery ( batteryIconTooltipNew ) where | ||
| 4 | |||
| 5 | import Control.Applicative | ||
| 6 | import Control.Monad | ||
| 7 | import Control.Monad.IO.Class | ||
| 8 | import Control.Monad.Trans.Reader | ||
| 9 | import Data.Int (Int64) | ||
| 10 | import qualified Data.Text as T | ||
| 11 | import GI.Gtk | ||
| 12 | import Prelude | ||
| 13 | import StatusNotifier.Tray (scalePixbufToSize) | ||
| 14 | import System.Taffybar.Context | ||
| 15 | import System.Taffybar.Information.Battery | ||
| 16 | import System.Taffybar.Util | ||
| 17 | import System.Taffybar.Widget.Generic.AutoSizeImage | ||
| 18 | import System.Taffybar.Widget.Generic.ChannelWidget | ||
| 19 | import Text.Printf | ||
| 20 | import Text.StringTemplate | ||
| 21 | import Data.Function ((&)) | ||
| 22 | |||
| 23 | -- | Just the battery info that will be used for display (this makes combining | ||
| 24 | -- several easier). | ||
| 25 | data BatteryWidgetInfo = BWI | ||
| 26 | { seconds :: Maybe Int64 | ||
| 27 | , percent :: Double | ||
| 28 | , status :: String | ||
| 29 | , rate :: Maybe Double | ||
| 30 | } deriving (Eq, Show) | ||
| 31 | |||
| 32 | -- | Format a duration expressed as seconds to hours and minutes | ||
| 33 | formatDuration :: Int64 -> String | ||
| 34 | formatDuration secs = let minutes, hours, minutes' :: Int64 | ||
| 35 | minutes = secs `div` 60 | ||
| 36 | (hours, minutes') = minutes `divMod` 60 | ||
| 37 | in printf "%02d:%02d" hours minutes' | ||
| 38 | |||
| 39 | getBatteryWidgetInfo :: BatteryInfo -> BatteryWidgetInfo | ||
| 40 | getBatteryWidgetInfo info = | ||
| 41 | let battPctNum :: Double | ||
| 42 | battPctNum = batteryPercentage info | ||
| 43 | battTime :: Maybe Int64 | ||
| 44 | battTime = | ||
| 45 | case batteryState info of | ||
| 46 | BatteryStateCharging -> Just $ batteryTimeToFull info | ||
| 47 | BatteryStateDischarging -> Just $ batteryTimeToEmpty info | ||
| 48 | _ -> Nothing | ||
| 49 | battStatus :: String | ||
| 50 | battStatus = | ||
| 51 | case batteryState info of | ||
| 52 | BatteryStateCharging -> "↑" | ||
| 53 | BatteryStateDischarging -> "↓" | ||
| 54 | BatteryStateEmpty -> "⤓" | ||
| 55 | BatteryStateFullyCharged -> "⤒" | ||
| 56 | _ -> "?" | ||
| 57 | battRate :: Maybe Double | ||
| 58 | battRate | rawRate < 0.1 = Nothing | ||
| 59 | | otherwise = Just rawRate | ||
| 60 | where rawRate = batteryEnergyRate info | ||
| 61 | in BWI{ seconds = battTime, percent = battPctNum, status = battStatus, rate = battRate } | ||
| 62 | |||
| 63 | -- | Given (maybe summarized) battery info and format: provides the string to display | ||
| 64 | formatBattInfo :: BatteryWidgetInfo -> String -> T.Text | ||
| 65 | formatBattInfo info fmt = | ||
| 66 | let tpl = newSTMP fmt | ||
| 67 | tpl' = tpl | ||
| 68 | & setManyAttrib [ ("percentage", printf "%.0f" $ percent info) | ||
| 69 | , ("status", status info) | ||
| 70 | ] | ||
| 71 | & setManyAttrib [ ("time", formatDuration <$> seconds info) | ||
| 72 | , ("rate", printf "%.0f" <$> rate info) | ||
| 73 | ] | ||
| 74 | in render tpl' | ||
| 75 | |||
| 76 | themeLoadFlags :: [IconLookupFlags] | ||
| 77 | themeLoadFlags = [IconLookupFlagsGenericFallback, IconLookupFlagsUseBuiltin] | ||
| 78 | |||
| 79 | batteryIconTooltipNew :: String -> TaffyIO Widget | ||
| 80 | batteryIconTooltipNew format = do | ||
| 81 | DisplayBatteryChanVar (chan, _) <- setupDisplayBatteryChanVar ["IconName", "State", "Percentage", "TimeToFull", "TimeToEmpty", "EnergyRate"] | ||
| 82 | ctx <- ask | ||
| 83 | liftIO $ do | ||
| 84 | image <- imageNew | ||
| 85 | styleCtx <- widgetGetStyleContext =<< toWidget image | ||
| 86 | defaultTheme <- iconThemeGetDefault | ||
| 87 | let getCurrentBatteryIconNameStringTooltip = do | ||
| 88 | info <- runReaderT getDisplayBatteryInfo ctx | ||
| 89 | let iconNameString = T.pack $ batteryIconName info | ||
| 90 | tooltip = formatBattInfo (getBatteryWidgetInfo info) format | ||
| 91 | return (iconNameString, tooltip) | ||
| 92 | extractPixbuf info = | ||
| 93 | fst <$> iconInfoLoadSymbolicForContext info styleCtx | ||
| 94 | setIconForSize size = do | ||
| 95 | (name, tooltip) <- getCurrentBatteryIconNameStringTooltip | ||
| 96 | widgetSetTooltipMarkup image $ Just tooltip | ||
| 97 | iconThemeLookupIcon defaultTheme name size themeLoadFlags >>= | ||
| 98 | traverse extractPixbuf >>= | ||
| 99 | traverse (scalePixbufToSize size OrientationHorizontal) | ||
| 100 | updateImage <- autoSizeImage image setIconForSize OrientationHorizontal | ||
| 101 | toWidget =<< channelWidgetNew image chan (const $ postGUIASync updateImage) | ||
diff --git a/accounts/gkleen@sif/taffybar/src/taffybar.hs b/accounts/gkleen@sif/taffybar/src/taffybar.hs new file mode 100644 index 00000000..dd713ea7 --- /dev/null +++ b/accounts/gkleen@sif/taffybar/src/taffybar.hs | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | {-# LANGUAGE OverloadedStrings #-} | ||
| 2 | |||
| 3 | module Main where | ||
| 4 | |||
| 5 | import System.Taffybar (startTaffybar) | ||
| 6 | import System.Taffybar.Context (TaffybarConfig(..)) | ||
| 7 | import System.Taffybar.Hooks | ||
| 8 | import System.Taffybar.SimpleConfig hiding (SimpleTaffyConfig(cssPath)) | ||
| 9 | import System.Taffybar.Widget | ||
| 10 | import qualified System.Taffybar.Widget.Clock as MyClock | ||
| 11 | import System.Taffybar.Widget.TooltipBattery | ||
| 12 | |||
| 13 | import Data.Time.Format | ||
| 14 | import Data.Time.LocalTime | ||
| 15 | import Data.Time.Calendar.WeekDate | ||
| 16 | |||
| 17 | import qualified Data.Text as T | ||
| 18 | |||
| 19 | import Control.Exception (SomeException, try) | ||
| 20 | import Control.Monad.Trans.Reader (mapReaderT) | ||
| 21 | |||
| 22 | import Paths_gkleen_sif_taffybar | ||
| 23 | |||
| 24 | |||
| 25 | main :: IO () | ||
| 26 | main = do | ||
| 27 | myCssPath <- getDataFileName "taffybar.css" | ||
| 28 | startTaffybar exampleTaffybarConfig{ cssPath = Just myCssPath } | ||
| 29 | |||
| 30 | |||
| 31 | exampleTaffybarConfig :: TaffybarConfig | ||
| 32 | exampleTaffybarConfig = | ||
| 33 | let myWorkspacesConfig = | ||
| 34 | defaultWorkspacesConfig | ||
| 35 | { maxIcons = Just 0 | ||
| 36 | , widgetGap = 7 | ||
| 37 | , showWorkspaceFn = \case | ||
| 38 | -- Workspace{ workspaceState = Empty } -> False | ||
| 39 | Workspace{ workspaceName } | workspaceName == "NSP" -> False | ||
| 40 | _other -> True | ||
| 41 | , getWindowIconPixbuf = \i d -> either (\(_ :: SomeException) -> Nothing) id <$> mapReaderT try (defaultGetWindowIconPixbuf i d) | ||
| 42 | } | ||
| 43 | workspaces = workspacesNew myWorkspacesConfig | ||
| 44 | clock = MyClock.textClockNewWith MyClock.defaultClockConfig | ||
| 45 | { MyClock.clockUpdateStrategy = MyClock.RoundedTargetInterval 1 0.0 | ||
| 46 | , MyClock.clockFormat = \tl zt@ZonedTime{ zonedTimeToLocalTime = LocalTime{ localDay } } | ||
| 47 | -> let date = formatTime tl "%Y-%m-%d" localDay | ||
| 48 | weekdate = "W" <> show2 woy <> "-" <> show dow | ||
| 49 | where (_, woy, dow) = toWeekDate localDay | ||
| 50 | show2 :: Int -> String | ||
| 51 | show2 x = replicate (2 - length s) '0' ++ s | ||
| 52 | where s = show x | ||
| 53 | time = formatTime tl "%H:%M:%S%Ez" zt | ||
| 54 | in T.intercalate " " $ map T.pack [date, weekdate, time] | ||
| 55 | } | ||
| 56 | layout = layoutNew defaultLayoutConfig | ||
| 57 | windowsW = windowsNew defaultWindowsConfig | ||
| 58 | { getMenuLabel = truncatedGetMenuLabel 80 | ||
| 59 | , getActiveLabel = truncatedGetActiveLabel 80 | ||
| 60 | } | ||
| 61 | worktime = commandRunnerNew 150 "worktime" [] "worktime" | ||
| 62 | worktimeToday = commandRunnerNew 150 "worktime" ["today"] "worktime today" | ||
| 63 | -- See https://github.com/taffybar/gtk-sni-tray#statusnotifierwatcher | ||
| 64 | -- for a better way to set up the sni tray | ||
| 65 | -- tray = sniTrayThatStartsWatcherEvenThoughThisIsABadWayToDoIt | ||
| 66 | tray = sniTrayNew | ||
| 67 | myConfig = defaultSimpleTaffyConfig | ||
| 68 | { startWidgets = | ||
| 69 | workspaces : map (>>= buildContentsBox) [ layout, windowsW ] | ||
| 70 | , endWidgets = map (>>= buildContentsBox) $ reverse | ||
| 71 | -- , mpris2New | ||
| 72 | [ worktime, worktimeToday | ||
| 73 | , clock | ||
| 74 | , tray | ||
| 75 | , batteryIconTooltipNew "$status$ $percentage$%$if(time)$$if(rate)$ ($rate$W $time$)$else$ ($time$)$endif$$elseif(rate)$ ($rate$W)$endif$" | ||
| 76 | ] | ||
| 77 | , barPosition = Top | ||
| 78 | , barPadding = 2 | ||
| 79 | , barHeight = 28 | ||
| 80 | , widgetSpacing = 10 | ||
| 81 | } | ||
| 82 | in withBatteryRefresh $ withLogServer $ | ||
| 83 | withToggleServer $ toTaffyConfig myConfig | ||
diff --git a/accounts/gkleen@sif/taffybar/taffybar.css b/accounts/gkleen@sif/taffybar/taffybar.css new file mode 100644 index 00000000..7a297465 --- /dev/null +++ b/accounts/gkleen@sif/taffybar/taffybar.css | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | @define-color transparent rgba(0.0, 0.0, 0.0, 0.0); | ||
| 2 | @define-color white #808080; | ||
| 3 | @define-color gray #202020; | ||
| 4 | @define-color green #008000; | ||
| 5 | @define-color yellow #808000; | ||
| 6 | @define-color blue #000080; | ||
| 7 | @define-color red #800000; | ||
| 8 | @define-color black #000000; | ||
| 9 | /* @define-color taffy-blue #0c7cd5; */ | ||
| 10 | @define-color taffy-blue @blue; | ||
| 11 | |||
| 12 | @define-color active-window-color @white; | ||
| 13 | @define-color urgent-window-color @taffy-blue; | ||
| 14 | @define-color font-color @white; | ||
| 15 | @define-color menu-background-color @black; | ||
| 16 | @define-color menu-font-color @white; | ||
| 17 | |||
| 18 | /* Top level styling */ | ||
| 19 | |||
| 20 | .taffy-window * { | ||
| 21 | /* | ||
| 22 | This removes any existing styling from UI elements. Taffybar will not | ||
| 23 | cohere with your gtk theme. | ||
| 24 | */ | ||
| 25 | all: unset; | ||
| 26 | |||
| 27 | font-family: "Fira Sans", sans-serif; | ||
| 28 | font-size: 21px; | ||
| 29 | color: @font-color; | ||
| 30 | } | ||
| 31 | |||
| 32 | .taffy-box { | ||
| 33 | /* border-radius: 10px; */ | ||
| 34 | background-color: @black; | ||
| 35 | } | ||
| 36 | |||
| 37 | .inner-pad { | ||
| 38 | /* padding-bottom: 5px; */ | ||
| 39 | /* padding-top: 5px; */ | ||
| 40 | padding-left: 2px; | ||
| 41 | padding-right: 2px; | ||
| 42 | } | ||
| 43 | |||
| 44 | .contents { | ||
| 45 | /* padding-bottom: 4px; */ | ||
| 46 | /* padding-top: 4px; */ | ||
| 47 | padding-right: 2px; | ||
| 48 | padding-left: 2px; | ||
| 49 | transition: background-color .5s; | ||
| 50 | border-radius: 5px; | ||
| 51 | } | ||
| 52 | |||
| 53 | /* Workspaces styling */ | ||
| 54 | |||
| 55 | .workspace-label { | ||
| 56 | padding-right: 3px; | ||
| 57 | padding-left: 2px; | ||
| 58 | font-size: 21px; | ||
| 59 | } | ||
| 60 | |||
| 61 | .workspace-label.active { | ||
| 62 | color: @green; | ||
| 63 | } | ||
| 64 | .workspace-label.visible { | ||
| 65 | color: @yellow; | ||
| 66 | } | ||
| 67 | .workspace-label.empty { | ||
| 68 | color: @gray; | ||
| 69 | } | ||
| 70 | .workspace-label.urgent { | ||
| 71 | color: @red; | ||
| 72 | } | ||
| 73 | |||
| 74 | .active .contents { | ||
| 75 | background-color: rgba(0.0, 0.0, 0.0, 0.5); | ||
| 76 | } | ||
| 77 | |||
| 78 | .visible .contents { | ||
| 79 | background-color: rgba(0.0, 0.0, 0.0, 0.2); | ||
| 80 | } | ||
| 81 | |||
| 82 | .window-icon-container { | ||
| 83 | transition: opacity .5s, box-shadow .5s; | ||
| 84 | opacity: 1; | ||
| 85 | } | ||
| 86 | |||
| 87 | /* This gives space for the box-shadow (they look like underlines) that follow. | ||
| 88 | This will actually affect all widgets, (not just the workspace icons), but | ||
| 89 | that is what we want since we want the icons to look the same. */ | ||
| 90 | .auto-size-image, .sni-tray { | ||
| 91 | padding-top: 3px; | ||
| 92 | padding-bottom: 3px; | ||
| 93 | } | ||
| 94 | |||
| 95 | .window-icon-container.active { | ||
| 96 | box-shadow: inset 0 -3px @white; | ||
| 97 | } | ||
| 98 | |||
| 99 | .window-icon-container.urgent { | ||
| 100 | box-shadow: inset 0 -3px @urgent-window-color; | ||
| 101 | } | ||
| 102 | |||
| 103 | .window-icon-container.inactive .window-icon { | ||
| 104 | padding: 0px; | ||
| 105 | } | ||
| 106 | |||
| 107 | .window-icon-container.minimized .window-icon { | ||
| 108 | opacity: .3; | ||
| 109 | } | ||
| 110 | |||
| 111 | .window-icon { | ||
| 112 | opacity: 1; | ||
| 113 | transition: opacity .5s; | ||
| 114 | } | ||
| 115 | |||
| 116 | /* Button styling */ | ||
| 117 | |||
| 118 | button { | ||
| 119 | background-color: @transparent; | ||
| 120 | border-width: 0px; | ||
| 121 | border-radius: 0px; | ||
| 122 | } | ||
| 123 | |||
| 124 | button:checked, button:hover .Contents:hover { | ||
| 125 | box-shadow: inset 0 -3px @taffy-blue; | ||
| 126 | } | ||
| 127 | |||
| 128 | /* Menu styling */ | ||
| 129 | |||
| 130 | /* The ".taffy-window" prefixed selectors are needed because if they aren't present, | ||
| 131 | the top level .Taffybar selector takes precedence */ | ||
| 132 | .taffy-window menuitem *, menuitem * { | ||
| 133 | color: @menu-font-color; | ||
| 134 | } | ||
| 135 | |||
| 136 | .taffy-window menuitem, menuitem { | ||
| 137 | background-color: @menu-background-color; | ||
| 138 | } | ||
| 139 | |||
| 140 | .taffy-window menuitem:hover, menuitem:hover { | ||
| 141 | background-color: @taffy-blue; | ||
| 142 | } | ||
| 143 | |||
| 144 | .taffy-window menuitem:hover > label, menuitem:hover > label { | ||
| 145 | color: @white; | ||
| 146 | } | ||
diff --git a/accounts/gkleen@sif/xmobar/default.nix b/accounts/gkleen@sif/xmobar/default.nix deleted file mode 100644 index fcac5e60..00000000 --- a/accounts/gkleen@sif/xmobar/default.nix +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | argumentPackages@{ ... }: | ||
| 2 | |||
| 3 | let | ||
| 4 | # defaultPackages = (import ./stackage.nix {}); | ||
| 5 | # haskellPackages = defaultPackages // argumentPackages; | ||
| 6 | haskellPackages = argumentPackages; | ||
| 7 | in haskellPackages.callPackage ./xmobar-yggdrasil.nix {} | ||
diff --git a/accounts/gkleen@sif/xmobar/nixpkgs.nix b/accounts/gkleen@sif/xmobar/nixpkgs.nix deleted file mode 100644 index 783ede00..00000000 --- a/accounts/gkleen@sif/xmobar/nixpkgs.nix +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | { nixpkgs ? import <nixpkgs> | ||
| 2 | }: | ||
| 3 | |||
| 4 | import ((nixpkgs {}).fetchFromGitHub { | ||
| 5 | owner = "NixOS"; | ||
| 6 | repo = "nixpkgs"; | ||
| 7 | rev = "10e61bf5be57736035ec7a804cb0bf3d083bf2cf"; | ||
| 8 | sha256 = "0fplfm2zx4vk7gs8bdcxnvzkdmpx2w0llqwf8475z9dz9cl132rm"; | ||
| 9 | }) | ||
diff --git a/accounts/gkleen@sif/xmobar/package.yaml b/accounts/gkleen@sif/xmobar/package.yaml deleted file mode 100644 index b638b6ac..00000000 --- a/accounts/gkleen@sif/xmobar/package.yaml +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | name: xmobar-yggdrasil | ||
| 2 | |||
| 3 | executables: | ||
| 4 | xmobar: | ||
| 5 | dependencies: | ||
| 6 | - base | ||
| 7 | - xmobar | ||
| 8 | |||
| 9 | main: xmobar.hs | ||
| 10 | source-dirs: | ||
| 11 | - . | ||
| 12 | |||
| 13 | ghc-options: -threaded | ||
diff --git a/accounts/gkleen@sif/xmobar/shell.nix b/accounts/gkleen@sif/xmobar/shell.nix deleted file mode 100644 index 16beb322..00000000 --- a/accounts/gkleen@sif/xmobar/shell.nix +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | { nixpkgs ? import ./nixpkgs.nix {} }: | ||
| 2 | |||
| 3 | let | ||
| 4 | inherit (nixpkgs {}) pkgs; | ||
| 5 | haskellPackages = import ./stackage.nix { inherit nixpkgs; }; | ||
| 6 | |||
| 7 | drv = haskellPackages.callPackage ./xmobar-yggdrasil.nix {}; | ||
| 8 | override = oldAttrs: { | ||
| 9 | nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; []) ++ (with haskellPackages; [ stack cabal-install cabal2nix ]); | ||
| 10 | shellHook = '' | ||
| 11 | export PROMPT_INFO="${oldAttrs.name}" | ||
| 12 | |||
| 13 | if [ -n "$ZSH_VERSION" ]; then | ||
| 14 | autoload -U +X compinit && compinit | ||
| 15 | autoload -U +X bashcompinit && bashcompinit | ||
| 16 | fi | ||
| 17 | eval "$(stack --bash-completion-script stack)" | ||
| 18 | |||
| 19 | ${oldAttrs.shellHook} | ||
| 20 | ''; | ||
| 21 | }; | ||
| 22 | |||
| 23 | dummy = pkgs.stdenv.mkDerivation { | ||
| 24 | name = "interactive-xmobar-environment"; | ||
| 25 | shellHook = ""; | ||
| 26 | }; | ||
| 27 | in pkgs.lib.overrideDerivation dummy override | ||
| 28 | #pkgs.lib.overrideDerivation drv.env override | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.nix b/accounts/gkleen@sif/xmobar/stack.nix deleted file mode 100644 index 17a49e04..00000000 --- a/accounts/gkleen@sif/xmobar/stack.nix +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | { ghc, nixpkgs ? import ./nixpkgs.nix {} }: | ||
| 2 | |||
| 3 | let | ||
| 4 | haskellPackages = import ./stackage.nix { inherit nixpkgs; }; | ||
| 5 | inherit (nixpkgs {}) pkgs; | ||
| 6 | in pkgs.haskell.lib.buildStackProject { | ||
| 7 | inherit ghc; | ||
| 8 | inherit (haskellPackages) stack; | ||
| 9 | name = "stackenv"; | ||
| 10 | buildInputs = (with pkgs; | ||
| 11 | [ xorg.libX11 xorg.libXrandr xorg.libXinerama xorg.libXScrnSaver xorg.libXext xorg.libXft | ||
| 12 | cairo | ||
| 13 | glib | ||
| 14 | ]) ++ (with haskellPackages; | ||
| 15 | [ | ||
| 16 | ]); | ||
| 17 | } | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.yaml b/accounts/gkleen@sif/xmobar/stack.yaml deleted file mode 100644 index b8ed1147..00000000 --- a/accounts/gkleen@sif/xmobar/stack.yaml +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | nix: | ||
| 2 | enable: true | ||
| 3 | shell-file: stack.nix | ||
| 4 | |||
| 5 | resolver: lts-13.21 | ||
| 6 | |||
| 7 | packages: | ||
| 8 | - . | ||
| 9 | |||
| 10 | extra-deps: [] | ||
diff --git a/accounts/gkleen@sif/xmobar/stack.yaml.lock b/accounts/gkleen@sif/xmobar/stack.yaml.lock deleted file mode 100644 index fcc2f5f3..00000000 --- a/accounts/gkleen@sif/xmobar/stack.yaml.lock +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | # This file was autogenerated by Stack. | ||
| 2 | # You should not edit this file by hand. | ||
| 3 | # For more information, please see the documentation at: | ||
| 4 | # https://docs.haskellstack.org/en/stable/lock_files | ||
| 5 | |||
| 6 | packages: [] | ||
| 7 | snapshots: | ||
| 8 | - completed: | ||
| 9 | size: 498180 | ||
| 10 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/13/21.yaml | ||
| 11 | sha256: eff2de19a6d4691ccbf6edc1fba858f1918683047dce0f09adede874bbd2a8f3 | ||
| 12 | original: lts-13.21 | ||
diff --git a/accounts/gkleen@sif/xmobar/stackage.nix b/accounts/gkleen@sif/xmobar/stackage.nix deleted file mode 100644 index c162ca2c..00000000 --- a/accounts/gkleen@sif/xmobar/stackage.nix +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | { nixpkgs ? import ./nixpkgs.nix {} | ||
| 2 | , snapshot ? "lts-13.21" | ||
| 3 | }: | ||
| 4 | |||
| 5 | let | ||
| 6 | stackage = import (fetchTarball { | ||
| 7 | url = "https://stackage.serokell.io/zb36jsy3r5h4ydz0pnp00g9vk94dvv03-stackage/default.nix.tar.gz"; | ||
| 8 | sha256 = "0h6f80gds0ds77y51hhiadh2h2k8njqq8n0gayp729ana9m9agma"; | ||
| 9 | }); | ||
| 10 | |||
| 11 | overlays = | ||
| 12 | [ stackage."${snapshot}" | ||
| 13 | (self: super: { | ||
| 14 | haskell = super.haskell // { | ||
| 15 | packages = super.haskell.packages // { | ||
| 16 | "${snapshot}" = super.haskell.packages."${snapshot}".override { | ||
| 17 | overrides = hself: hsuper: { | ||
| 18 | zip-archive = self.haskell.lib.overrideCabal hsuper.zip-archive (old: { | ||
| 19 | testToolDepends = old.testToolDepends ++ (with self; [ unzip which ]); | ||
| 20 | }); | ||
| 21 | alex = self.haskell.lib.dontCheck hsuper.alex; | ||
| 22 | }; | ||
| 23 | }; | ||
| 24 | }; | ||
| 25 | }; | ||
| 26 | } | ||
| 27 | ) | ||
| 28 | ]; | ||
| 29 | |||
| 30 | inherit (nixpkgs { inherit overlays; }) pkgs; | ||
| 31 | in pkgs.haskell.packages."${snapshot}" | ||
diff --git a/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix b/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix deleted file mode 100644 index 852fb8e5..00000000 --- a/accounts/gkleen@sif/xmobar/xmobar-yggdrasil.nix +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | { mkDerivation, base, hpack, lib, xmobar }: | ||
| 2 | mkDerivation { | ||
| 3 | pname = "xmobar-yggdrasil"; | ||
| 4 | version = "0.0.0"; | ||
| 5 | src = ./.; | ||
| 6 | isLibrary = false; | ||
| 7 | isExecutable = true; | ||
| 8 | libraryToolDepends = [ hpack ]; | ||
| 9 | executableHaskellDepends = [ base xmobar ]; | ||
| 10 | preConfigure = "hpack"; | ||
| 11 | license = "unknown"; | ||
| 12 | hydraPlatforms = lib.platforms.none; | ||
| 13 | } | ||
diff --git a/accounts/gkleen@sif/xmobar/xmobar.hs b/accounts/gkleen@sif/xmobar/xmobar.hs deleted file mode 100644 index 322b4449..00000000 --- a/accounts/gkleen@sif/xmobar/xmobar.hs +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | import Xmobar | ||
| 2 | |||
| 3 | import Data.List (intercalate) | ||
| 4 | |||
| 5 | |||
| 6 | main :: IO () | ||
| 7 | main = xmobar config | ||
| 8 | where | ||
| 9 | config = defaultConfig | ||
| 10 | { font = "xft:FiraCode Nerd Font Mono:style=Regular:pixelsize=21" | ||
| 11 | , position = OnScreen 0 $ TopP 0 307 | ||
| 12 | , bgColor = "black" | ||
| 13 | , fgColor = "#808080" | ||
| 14 | , overrideRedirect = False | ||
| 15 | , template = | ||
| 16 | let left = intercalate " | " | ||
| 17 | [ "%XMonadWorkspaces%" | ||
| 18 | , "%XMonadLayout%" | ||
| 19 | , "%XMonadTitle%" | ||
| 20 | ] | ||
| 21 | right = intercalate " | " | ||
| 22 | [ {- "%status%" | ||
| 23 | , -} "%battery%" | ||
| 24 | , "%kbd%" | ||
| 25 | , "%worktime%" | ||
| 26 | , "%worktime-today%" | ||
| 27 | , "%date%" | ||
| 28 | , "%weekdate%" | ||
| 29 | , "%time%" | ||
| 30 | ] | ||
| 31 | in left <> "}{" <> right | ||
| 32 | , commands = | ||
| 33 | [ Run $ NamedXPropertyLog "_XMONAD_WORKSPACES" "XMonadWorkspaces" | ||
| 34 | , Run $ NamedXPropertyLog "_XMONAD_LAYOUT" "XMonadLayout" | ||
| 35 | , Run $ NamedXPropertyLog "_XMONAD_TITLE" "XMonadTitle" | ||
| 36 | , Run $ Date "%Y-%m-%d" "date" 500 | ||
| 37 | , Run $ Date "W%V-%u" "weekdate" 500 | ||
| 38 | , Run $ Date "%H:%M:%S%Ez" "time" 2 | ||
| 39 | , Run $ Com "worktime" [] "worktime" 1500 | ||
| 40 | , Run $ Com "worktime" ["today"] "worktime-today" 1500 | ||
| 41 | , Run $ Com "ssh" ["status.odin"] "status" 600 | ||
| 42 | , Run $ Kbd [("us(dvp)", "dvp")] | ||
| 43 | , Run $ Battery | ||
| 44 | [ "--template", "<watts> <left> (<timeleft>) AC <acstatus>" | ||
| 45 | , "--suffix", "On" | ||
| 46 | , "--Low", "10" | ||
| 47 | , "--High", "80" | ||
| 48 | , "--low", "darkred" | ||
| 49 | , "--normal", "darkorange" | ||
| 50 | , "--high", "darkgreen" | ||
| 51 | , "-p", "3" | ||
| 52 | ] 50 | ||
| 53 | ] | ||
| 54 | } | ||
diff --git a/accounts/gkleen@sif/xmonad/package.yaml b/accounts/gkleen@sif/xmonad/package.yaml index 48de1a53..f65137af 100644 --- a/accounts/gkleen@sif/xmonad/package.yaml +++ b/accounts/gkleen@sif/xmonad/package.yaml | |||
| @@ -23,6 +23,7 @@ executables: | |||
| 23 | - containers | 23 | - containers |
| 24 | - hostname | 24 | - hostname |
| 25 | - libnotify | 25 | - libnotify |
| 26 | - taffybar | ||
| 26 | 27 | ||
| 27 | main: xmonad.hs | 28 | main: xmonad.hs |
| 28 | source-dirs: | 29 | source-dirs: |
diff --git a/accounts/gkleen@sif/xmonad/xmonad-yggdrasil.nix b/accounts/gkleen@sif/xmonad/xmonad-yggdrasil.nix index d3d72310..7c853619 100644 --- a/accounts/gkleen@sif/xmonad/xmonad-yggdrasil.nix +++ b/accounts/gkleen@sif/xmonad/xmonad-yggdrasil.nix | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | { mkDerivation, aeson, base, bytestring, containers, directory | 1 | { mkDerivation, aeson, base, bytestring, containers, directory |
| 2 | , filepath, hostname, hpack, mtl, network, parsec, process, lib | 2 | , filepath, hostname, hpack, mtl, network, parsec, process, lib |
| 3 | , temporary, transformers, unix, utf8-string, X11, xmonad | 3 | , temporary, transformers, unix, utf8-string, X11, xmonad |
| 4 | , xmonad-contrib, libnotify | 4 | , xmonad-contrib, libnotify, taffybar |
| 5 | }: | 5 | }: |
| 6 | mkDerivation { | 6 | mkDerivation { |
| 7 | pname = "xmonad-yggdrasil"; | 7 | pname = "xmonad-yggdrasil"; |
| @@ -13,7 +13,7 @@ mkDerivation { | |||
| 13 | executableHaskellDepends = [ | 13 | executableHaskellDepends = [ |
| 14 | aeson base bytestring containers directory filepath hostname mtl | 14 | aeson base bytestring containers directory filepath hostname mtl |
| 15 | network parsec process temporary transformers unix utf8-string X11 | 15 | network parsec process temporary transformers unix utf8-string X11 |
| 16 | xmonad xmonad-contrib libnotify | 16 | xmonad xmonad-contrib libnotify taffybar |
| 17 | ]; | 17 | ]; |
| 18 | preConfigure = "hpack"; | 18 | preConfigure = "hpack"; |
| 19 | license = "unknown"; | 19 | license = "unknown"; |
diff --git a/accounts/gkleen@sif/xmonad/xmonad.hs b/accounts/gkleen@sif/xmonad/xmonad.hs index aba245ff..c642a3a7 100644 --- a/accounts/gkleen@sif/xmonad/xmonad.hs +++ b/accounts/gkleen@sif/xmonad/xmonad.hs | |||
| @@ -75,6 +75,8 @@ import qualified XMonad.Actions.PhysicalScreens as P | |||
| 75 | 75 | ||
| 76 | import XMonad.Layout.IM | 76 | import XMonad.Layout.IM |
| 77 | 77 | ||
| 78 | import System.Taffybar.Support.PagerHints (pagerHints) | ||
| 79 | |||
| 78 | import XMonad.Prompt.MyShell | 80 | import XMonad.Prompt.MyShell |
| 79 | import XMonad.Prompt.MyPass | 81 | import XMonad.Prompt.MyPass |
| 80 | import XMonad.Prompt.MySsh | 82 | import XMonad.Prompt.MySsh |
| @@ -142,6 +144,12 @@ defaultHost = Host { hName = "unkown" | |||
| 142 | browser :: String | 144 | browser :: String |
| 143 | browser = "env MOZ_USE_XINPUT2=1 firefox" | 145 | browser = "env MOZ_USE_XINPUT2=1 firefox" |
| 144 | 146 | ||
| 147 | gray, darkGray, red, green :: String | ||
| 148 | gray = "#808080" | ||
| 149 | darkGray = "#202020" | ||
| 150 | red = "#800000" | ||
| 151 | green = "#008000" | ||
| 152 | |||
| 145 | hostFromName :: HostName -> Host | 153 | hostFromName :: HostName -> Host |
| 146 | hostFromName h@("vali") = defaultHost { hName = h | 154 | hostFromName h@("vali") = defaultHost { hName = h |
| 147 | , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm | 155 | , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm |
| @@ -222,7 +230,7 @@ hostFromName h | |||
| 222 | , hCoWsp = hCoWsp | 230 | , hCoWsp = hCoWsp |
| 223 | , hKeysMod = \conf -> Map.union $ (Map.fromList $ join $ map (spawnBindings conf) [ (xK_e, ["emacsclient -c"]) | 231 | , hKeysMod = \conf -> Map.union $ (Map.fromList $ join $ map (spawnBindings conf) [ (xK_e, ["emacsclient -c"]) |
| 224 | , (xK_d, [fromString browser, "google-chrome", "notmuch-links"]) | 232 | , (xK_d, [fromString browser, "google-chrome", "notmuch-links"]) |
| 225 | , (xK_c, [ inputPrompt xPConfig "dc" ?+ dc ]) | 233 | , (xK_c, [ inputPrompt xPConfigMonospace "dc" ?+ dc ]) |
| 226 | , (xK_g, ["pidgin"]) | 234 | , (xK_g, ["pidgin"]) |
| 227 | , (xK_s, ["skype"]) | 235 | , (xK_s, ["skype"]) |
| 228 | -- , (xK_p, [mkPassPrompt "Type password" pwType xPConfig, mkPassPrompt "Show password" pwShow xPConfig, mkPassPrompt "Copy password" pwClip xPConfig]) | 236 | -- , (xK_p, [mkPassPrompt "Type password" pwType xPConfig, mkPassPrompt "Show password" pwShow xPConfig, mkPassPrompt "Copy password" pwClip xPConfig]) |
| @@ -240,10 +248,10 @@ hostFromName h | |||
| 240 | , "emacsclient -c -F \"'(title . \\\"Mail\\\")\" -e \"(browse-url-mail \"$(xclip -o)\")\"" | 248 | , "emacsclient -c -F \"'(title . \\\"Mail\\\")\" -e \"(browse-url-mail \"$(xclip -o)\")\"" |
| 241 | ]) | 249 | ]) |
| 242 | , (xK_Return, ["keynav start,windowzoom", "keynav start"]) | 250 | , (xK_Return, ["keynav start,windowzoom", "keynav start"]) |
| 243 | , (xK_t, [inputPrompt xPConfig "fuzzytime timer" ?+ fuzzytime, fuzzytime "unset", work_fuzzytime]) | 251 | , (xK_t, [inputPrompt xPConfigMonospace "fuzzytime timer" ?+ fuzzytime, fuzzytime "unset", work_fuzzytime]) |
| 244 | , (xK_a, [inputPrompt xPConfig "adjmix" ?+ adjmix]) | 252 | , (xK_a, [inputPrompt xPConfigMonospace "adjmix" ?+ adjmix]) |
| 245 | , (xK_s, [ inputPromptWithCompl xPConfig "start synergy" synergyCompl ?+ synergyStart | 253 | , (xK_s, [ inputPromptWithCompl xPConfigMonospace "start synergy" synergyCompl ?+ synergyStart |
| 246 | , inputPromptWithCompl xPConfig "stop synergy" synergyCompl ?+ synergyStop | 254 | , inputPromptWithCompl xPConfigMonospace "stop synergy" synergyCompl ?+ synergyStop |
| 247 | ]) | 255 | ]) |
| 248 | , (xK_h, [ "alacritty --class htop -e htop" | 256 | , (xK_h, [ "alacritty --class htop -e htop" |
| 249 | , "alacritty --class log -e journalctl -xef" | 257 | , "alacritty --class log -e journalctl -xef" |
| @@ -447,14 +455,14 @@ tabbedTheme = def | |||
| 447 | { activeColor = "black" | 455 | { activeColor = "black" |
| 448 | , inactiveColor = "black" | 456 | , inactiveColor = "black" |
| 449 | , urgentColor = "black" | 457 | , urgentColor = "black" |
| 450 | , activeBorderColor = "grey" | 458 | , activeBorderColor = gray |
| 451 | , inactiveBorderColor = "#202020" | 459 | , inactiveBorderColor = darkGray |
| 452 | , urgentBorderColor = "#bb0000" | 460 | , urgentBorderColor = red |
| 453 | , activeTextColor = "grey" | 461 | , activeTextColor = gray |
| 454 | , inactiveTextColor = "grey" | 462 | , inactiveTextColor = gray |
| 455 | , urgentTextColor = "grey" | 463 | , urgentTextColor = gray |
| 456 | , decoHeight = 32 | 464 | , decoHeight = 32 |
| 457 | , fontName = "xft:Fira Mono for Powerline:style=Medium:pixelsize=22.5" | 465 | , fontName = "xft:Fira Sans:pixelsize=21" |
| 458 | } | 466 | } |
| 459 | 467 | ||
| 460 | main :: IO () | 468 | main :: IO () |
| @@ -477,7 +485,7 @@ main = do | |||
| 477 | let | 485 | let |
| 478 | host = hostFromName hostname | 486 | host = hostFromName hostname |
| 479 | setEnv "HOST" hostname | 487 | setEnv "HOST" hostname |
| 480 | let myConfig = withHostUrgency . ewmh $ docks def | 488 | let myConfig = withHostUrgency . ewmh . pagerHints $ docks def |
| 481 | { manageHook = hManageHook host | 489 | { manageHook = hManageHook host |
| 482 | , terminal = "alacritty" | 490 | , terminal = "alacritty" |
| 483 | , layoutHook = smartBorders . avoidStruts $ windowNavigation layout' | 491 | , layoutHook = smartBorders . avoidStruts $ windowNavigation layout' |
| @@ -488,8 +496,8 @@ main = do | |||
| 488 | , keys = \conf -> hKeysMod host conf $ myKeys' conf host | 496 | , keys = \conf -> hKeysMod host conf $ myKeys' conf host |
| 489 | , workspaces = take (length numKeys) $ map wsp [1..] | 497 | , workspaces = take (length numKeys) $ map wsp [1..] |
| 490 | , startupHook = setDefaultCursor xC_left_ptr | 498 | , startupHook = setDefaultCursor xC_left_ptr |
| 491 | , normalBorderColor = "#202020" | 499 | , normalBorderColor = darkGray |
| 492 | , focusedBorderColor = "grey" | 500 | , focusedBorderColor = gray |
| 493 | , handleEventHook = fullscreenEventHook <+> (serverModeEventHookCmd' $ hCmds host) <+> keyUpEventHook | 501 | , handleEventHook = fullscreenEventHook <+> (serverModeEventHookCmd' $ hCmds host) <+> keyUpEventHook |
| 494 | } | 502 | } |
| 495 | writeProps str = do | 503 | writeProps str = do |
| @@ -562,7 +570,7 @@ main = do | |||
| 562 | _ -> id | 570 | _ -> id |
| 563 | urgencyHook' window = do | 571 | urgencyHook' window = do |
| 564 | runQuery ((resource =? "comm" <||> resource =? "Pidgin" <||> className =? "Gajim" <||> className =? "Skype") --> safeSpawn "thinklight" ["Blink", "100"]) window | 572 | runQuery ((resource =? "comm" <||> resource =? "Pidgin" <||> className =? "Gajim" <||> className =? "Skype") --> safeSpawn "thinklight" ["Blink", "100"]) window |
| 565 | urgencyHook (BorderUrgencyHook { urgencyBorderColor = "#bb0000" }) window | 573 | urgencyHook (BorderUrgencyHook { urgencyBorderColor = red }) window |
| 566 | shutdown :: SomeException -> IO a | 574 | shutdown :: SomeException -> IO a |
| 567 | shutdown e = do | 575 | shutdown e = do |
| 568 | let pids = [ -- batteryMon | 576 | let pids = [ -- batteryMon |
| @@ -666,18 +674,19 @@ instance Shrinker CustomShrink where | |||
| 666 | | length cs >= 4 = cs : shrinkIt s ((reverse . drop 4 . reverse $ cs) ++ "...") | 674 | | length cs >= 4 = cs : shrinkIt s ((reverse . drop 4 . reverse $ cs) ++ "...") |
| 667 | | otherwise = cs : shrinkIt s (init cs) | 675 | | otherwise = cs : shrinkIt s (init cs) |
| 668 | 676 | ||
| 669 | xPConfig :: XPConfig | 677 | xPConfig, xPConfigMonospace :: XPConfig |
| 670 | xPConfig = def | 678 | xPConfig = def |
| 671 | { font = "xft:Fira Mono for Powerline:style=Medium:pixelsize=22.5" | 679 | { font = "xft:Fira Sans:pixelsize=21" |
| 672 | , height = 32 | 680 | , height = 32 |
| 673 | , bgColor = "black" | 681 | , bgColor = "black" |
| 674 | , fgColor = "grey" | 682 | , fgColor = gray |
| 675 | , fgHLight = "green" | 683 | , fgHLight = green |
| 676 | , bgHLight = "black" | 684 | , bgHLight = "black" |
| 677 | , borderColor = "grey" | 685 | , borderColor = gray |
| 678 | , searchPredicate = (\needle haystack -> all (`isInfixOf` map toLower haystack) . map (map toLower) $ words needle) | 686 | , searchPredicate = (\needle haystack -> all (`isInfixOf` map toLower haystack) . map (map toLower) $ words needle) |
| 679 | , position = Top | 687 | , position = Top |
| 680 | } | 688 | } |
| 689 | xPConfigMonospace = xPConfig { font = "xft:Fira Code:pixelsize=21" } | ||
| 681 | 690 | ||
| 682 | sshOverrides host = map (\h -> mkOverride { oHost = h, oCommand = moshCmd . inTmux host} ) | 691 | sshOverrides host = map (\h -> mkOverride { oHost = h, oCommand = moshCmd . inTmux host} ) |
| 683 | [ "odin" | 692 | [ "odin" |
| @@ -767,9 +776,9 @@ myKeys' conf host = Map.fromList $ | |||
| 767 | 776 | ||
| 768 | -- launch dmenu | 777 | -- launch dmenu |
| 769 | --, ((modm, xK_d ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") | 778 | --, ((modm, xK_d ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"") |
| 770 | , ((modm, xK_d ), shellPrompt "Run: " xPConfig) | 779 | , ((modm, xK_d ), shellPrompt "Run: " xPConfigMonospace) |
| 771 | , ((modm .|. shiftMask, xK_d ), prompt "Run in Terminal: " ("alacritty" ++ " -e") xPConfig) | 780 | , ((modm .|. shiftMask, xK_d ), prompt "Run in Terminal: " ("alacritty" ++ " -e") xPConfigMonospace) |
| 772 | , ((modm, xK_at ), sshPrompt (sshOverrides . Just $ hName host) xPConfig) | 781 | , ((modm, xK_at ), sshPrompt (sshOverrides . Just $ hName host) xPConfigMonospace) |
| 773 | 782 | ||
| 774 | -- close focused window | 783 | -- close focused window |
| 775 | , ((modm .|. shiftMask, xK_q ), kill) | 784 | , ((modm .|. shiftMask, xK_q ), kill) |
diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index 35b3e6e7..3c9cf390 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix | |||
| @@ -149,6 +149,8 @@ | |||
| 149 | 149 | ||
| 150 | vnstat.enable = true; | 150 | vnstat.enable = true; |
| 151 | 151 | ||
| 152 | upower.enable = true; | ||
| 153 | |||
| 152 | logind = { | 154 | logind = { |
| 153 | lidSwitch = "suspend"; | 155 | lidSwitch = "suspend"; |
| 154 | lidSwitchDocked = "lock"; | 156 | lidSwitchDocked = "lock"; |
