From 2878f3134722d87b76f80cdf3092f216986b3ce6 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 15 Feb 2024 22:03:18 +0100 Subject: [PATCH 1/7] polybar: Add basic setup of polybar --- home/alex/services/polybar/config.ini | 179 +++++++++++++++++++++++++ home/alex/services/polybar/default.nix | 19 +++ 2 files changed, 198 insertions(+) create mode 100644 home/alex/services/polybar/config.ini create mode 100644 home/alex/services/polybar/default.nix diff --git a/home/alex/services/polybar/config.ini b/home/alex/services/polybar/config.ini new file mode 100644 index 0000000..ae11e6f --- /dev/null +++ b/home/alex/services/polybar/config.ini @@ -0,0 +1,179 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +[colors] +background = #282A2E +background-alt = #373B41 +foreground = #C5C8C6 +primary = #F0C674 +secondary = #8ABEB7 +alert = #A54242 +disabled = #707880 + +[bar/main] +width = 100% +height = 24pt +radius = 6 + +; dpi = 96 + +background = ${colors.background} +foreground = ${colors.foreground} + +line-size = 3pt + +border-size = 4pt +border-color = #00000000 + +padding-left = 0 +padding-right = 1 + +module-margin = 1 + +separator = | +separator-foreground = ${colors.disabled} + +font-0 = monospace;2 + +modules-left = xworkspaces xwindow +modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date + +cursor-click = pointer +cursor-scroll = ns-resize + +enable-ipc = true + +tray-position = center + +; wm-restack = generic +; wm-restack = bspwm +; wm-restack = i3 + +; override-redirect = true + +[module/systray] +type = internal/tray + +format-margin = 8pt +tray-spacing = 16pt +tray-position = center + +[module/xworkspaces] +type = internal/xworkspaces + +label-active = %name% +label-active-background = ${colors.background-alt} +label-active-underline= ${colors.primary} +label-active-padding = 1 + +label-occupied = %name% +label-occupied-padding = 1 + +label-urgent = %name% +label-urgent-background = ${colors.alert} +label-urgent-padding = 1 + +label-empty = %name% +label-empty-foreground = ${colors.disabled} +label-empty-padding = 1 + +[module/xwindow] +type = internal/xwindow +label = %title:0:60:...% + +[module/filesystem] +type = internal/fs +interval = 25 + +mount-0 = / + +label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%% + +label-unmounted = %mountpoint% not mounted +label-unmounted-foreground = ${colors.disabled} + +[module/pulseaudio] +type = internal/pulseaudio + +format-volume-prefix = "VOL " +format-volume-prefix-foreground = ${colors.primary} +format-volume = + +label-volume = %percentage%% + +label-muted = muted +label-muted-foreground = ${colors.disabled} + +[module/xkeyboard] +type = internal/xkeyboard +blacklist-0 = num lock + +label-layout = %layout% +label-layout-foreground = ${colors.primary} + +label-indicator-padding = 2 +label-indicator-margin = 1 +label-indicator-foreground = ${colors.background} +label-indicator-background = ${colors.secondary} + +[module/memory] +type = internal/memory +interval = 2 +format-prefix = "RAM " +format-prefix-foreground = ${colors.primary} +label = %percentage_used:2%% + +[module/cpu] +type = internal/cpu +interval = 2 +format-prefix = "CPU " +format-prefix-foreground = ${colors.primary} +label = %percentage:2%% + +[network-base] +type = internal/network +interval = 5 +format-connected = +format-disconnected = +label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected + +[module/wlan] +inherit = network-base +interface-type = wireless +label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip% + +[module/eth] +inherit = network-base +interface-type = wired +label-connected = %{F#F0C674}%ifname%%{F-} %local_ip% + +[module/date] +type = internal/date +interval = 1 + +date = %H:%M +date-alt = %Y-%m-%d %H:%M:%S + +label = %date% +label-foreground = ${colors.primary} + +[settings] +screenchange-reload = true +pseudo-transparency = true + +; vim:ft=dosini diff --git a/home/alex/services/polybar/default.nix b/home/alex/services/polybar/default.nix new file mode 100644 index 0000000..0289fff --- /dev/null +++ b/home/alex/services/polybar/default.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: +let + mypolybar = pkgs.polybar.override { + alsaSupport = true; + mpdSupport = true; + pulseSupport = true; + }; +in { + home.packages = with pkgs; [ font-awesome material-design-icons ]; + + services.polybar = { + enable = true; + package = mypolybar; + config = ./config.ini; + script = '' + polybar & disown + ''; + }; +} From 00974f089d6c81d7e521696ad4902b268af0861d Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 15 Feb 2024 22:21:45 +0100 Subject: [PATCH 2/7] dregil: Import path instead of default.nix --- home/alex/home.nix | 5 +++-- home/alex/programs/rofi/default.nix | 4 ++-- home/alex/services/polybar/default.nix | 4 ++-- modules/wm/xmonad/default.nix | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/home/alex/home.nix b/home/alex/home.nix index d6211bd..7410d3b 100644 --- a/home/alex/home.nix +++ b/home/alex/home.nix @@ -3,8 +3,9 @@ { imports = [ ./cli.nix - # ./programs/xmonad/default.nix - ./programs/rofi/default.nix + ./programs/xmonad + ./programs/rofi + # ./programs/polybar ]; home = { diff --git a/home/alex/programs/rofi/default.nix b/home/alex/programs/rofi/default.nix index 2b7f6c4..c3f024a 100644 --- a/home/alex/programs/rofi/default.nix +++ b/home/alex/programs/rofi/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - programs.rofi = { + config.programs.rofi = { enable = true; plugins = with pkgs; [ rofi-calc rofi-emoji ]; terminal = "${pkgs.alacritty}/bin/alacritty"; @@ -12,5 +12,5 @@ }; # let rofi insert emojis directly - home.packages = [ pkgs.xdotool ]; + config.home.packages = [ pkgs.xdotool ]; } diff --git a/home/alex/services/polybar/default.nix b/home/alex/services/polybar/default.nix index 0289fff..c5f07c7 100644 --- a/home/alex/services/polybar/default.nix +++ b/home/alex/services/polybar/default.nix @@ -6,9 +6,9 @@ let pulseSupport = true; }; in { - home.packages = with pkgs; [ font-awesome material-design-icons ]; + config.home.packages = with pkgs; [ font-awesome material-design-icons ]; - services.polybar = { + config.services.polybar = { enable = true; package = mypolybar; config = ./config.ini; diff --git a/modules/wm/xmonad/default.nix b/modules/wm/xmonad/default.nix index c59ec4e..988cd29 100644 --- a/modules/wm/xmonad/default.nix +++ b/modules/wm/xmonad/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { - services = { + config.services = { upower.enable = true; xserver = { @@ -14,5 +14,5 @@ }; }; - systemd.services.upower.enable = true; + config.systemd.services.upower.enable = true; } From e5d573118b742b3b30f6d19db2040807a8a72acd Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 15 Feb 2024 22:22:12 +0100 Subject: [PATCH 3/7] services: Add configuration for dunst dunst is a notification daemon. --- home/alex/services/dunst/default.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 home/alex/services/dunst/default.nix diff --git a/home/alex/services/dunst/default.nix b/home/alex/services/dunst/default.nix new file mode 100644 index 0000000..4dacb5b --- /dev/null +++ b/home/alex/services/dunst/default.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +{ + config.services.dunst = { + enable = true; + iconTheme = { + name = "Adwaita"; + package = pkgs.gnome3.adwaita-icon-theme; + size = "16x16"; + }; + settings = { + global = { + monitor = 0; + geometry = "600x50-50+65"; + shrink = "yes"; + transparency = 10; + padding = 16; + horizontal_padding = 16; + font = "JetBrainsMono Nerd Font 10"; + line_height = 4; + format = "%s\\n%b"; + }; + }; + }; +} From 349685dfcf0c401bf1d95838e8e29201ac372ac3 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 15 Feb 2024 22:30:50 +0100 Subject: [PATCH 4/7] udiskie: Add basic config for automounter --- home/alex/services/udiskie/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 home/alex/services/udiskie/default.nix diff --git a/home/alex/services/udiskie/default.nix b/home/alex/services/udiskie/default.nix new file mode 100644 index 0000000..da7a5e2 --- /dev/null +++ b/home/alex/services/udiskie/default.nix @@ -0,0 +1,8 @@ +{ config, lib, pkgs, ... }: + +{ + config.services.udiskie = { + enable = true; + tray = "always"; + }; +} From 6c3d5ac59f7d51f2e835793db2db07cf40c4c4a6 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Thu, 15 Feb 2024 22:31:25 +0100 Subject: [PATCH 5/7] alex: Enable polybar dunst and udiskie services --- home/alex/home.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home/alex/home.nix b/home/alex/home.nix index 7410d3b..757cfda 100644 --- a/home/alex/home.nix +++ b/home/alex/home.nix @@ -5,7 +5,9 @@ ./cli.nix ./programs/xmonad ./programs/rofi - # ./programs/polybar + ./services/polybar + ./services/dunst + ./services/udiskie ]; home = { From 9dccdfc4a7054c55ce36c5e7e839113b86494d0c Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Fri, 16 Feb 2024 22:38:37 +0100 Subject: [PATCH 6/7] rofi: Use gruvbox theme --- home/alex/programs/rofi/default.nix | 1 + .../rofi/themes/gruvbox-dark-soft.rasi | 191 ++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 home/alex/programs/rofi/themes/gruvbox-dark-soft.rasi diff --git a/home/alex/programs/rofi/default.nix b/home/alex/programs/rofi/default.nix index c3f024a..20d548a 100644 --- a/home/alex/programs/rofi/default.nix +++ b/home/alex/programs/rofi/default.nix @@ -5,6 +5,7 @@ enable = true; plugins = with pkgs; [ rofi-calc rofi-emoji ]; terminal = "${pkgs.alacritty}/bin/alacritty"; + theme = ./themes/gruvbox-dark-soft.rasi; pass = { enable = true; stores = [ config.programs.password-store.settings.PASSWORD_STORE_DIR ]; diff --git a/home/alex/programs/rofi/themes/gruvbox-dark-soft.rasi b/home/alex/programs/rofi/themes/gruvbox-dark-soft.rasi new file mode 100644 index 0000000..597d883 --- /dev/null +++ b/home/alex/programs/rofi/themes/gruvbox-dark-soft.rasi @@ -0,0 +1,191 @@ +/* ========================================================================== + Rofi color theme + + Based on the Gruvbox color scheme for Vim by morhetz + https://github.com/morhetz/gruvbox + + File: gruvbox-dark-soft.rasi + Desc: Gruvbox dark (soft contrast) color theme for Rofi + Author: bardisty + Source: https://github.com/bardisty/gruvbox-rofi + Modified: Mon Feb 12 2018 06:04:37 PST -0800 + ========================================================================== */ + +* { + /* Theme settings */ + highlight: bold italic; + scrollbar: true; + + /* Gruvbox dark colors */ + gruvbox-dark-bg0-soft: #32302f; + gruvbox-dark-bg1: #3c3836; + gruvbox-dark-bg3: #665c54; + gruvbox-dark-fg0: #fbf1c7; + gruvbox-dark-fg1: #ebdbb2; + gruvbox-dark-red-dark: #cc241d; + gruvbox-dark-red-light: #fb4934; + gruvbox-dark-yellow-dark: #d79921; + gruvbox-dark-yellow-light: #fabd2f; + gruvbox-dark-gray: #a89984; + + /* Theme colors */ + background: @gruvbox-dark-bg0-soft; + background-color: @background; + foreground: @gruvbox-dark-fg1; + border-color: @gruvbox-dark-gray; + separatorcolor: @border-color; + scrollbar-handle: @border-color; + + normal-background: @background; + normal-foreground: @foreground; + alternate-normal-background: @gruvbox-dark-bg1; + alternate-normal-foreground: @foreground; + selected-normal-background: @gruvbox-dark-bg3; + selected-normal-foreground: @gruvbox-dark-fg0; + + active-background: @gruvbox-dark-yellow-dark; + active-foreground: @background; + alternate-active-background: @active-background; + alternate-active-foreground: @active-foreground; + selected-active-background: @gruvbox-dark-yellow-light; + selected-active-foreground: @active-foreground; + + urgent-background: @gruvbox-dark-red-dark; + urgent-foreground: @background; + alternate-urgent-background: @urgent-background; + alternate-urgent-foreground: @urgent-foreground; + selected-urgent-background: @gruvbox-dark-red-light; + selected-urgent-foreground: @urgent-foreground; +} + +/* ========================================================================== + File: gruvbox-common.rasi + Desc: Shared rules between all gruvbox themes + Author: bardisty + Source: https://github.com/bardisty/gruvbox-rofi + Modified: Mon Feb 12 2018 06:06:47 PST -0800 + ========================================================================== */ + +window { + background-color: @background; + border: 2; + padding: 2; +} + +mainbox { + border: 0; + padding: 0; +} + +message { + border: 2px 0 0; + border-color: @separatorcolor; + padding: 1px; +} + +textbox { + highlight: @highlight; + text-color: @foreground; +} + +listview { + border: 2px solid 0 0; + padding: 2px 0 0; + border-color: @separatorcolor; + spacing: 2px; + scrollbar: @scrollbar; +} + +element { + border: 0; + padding: 2px; +} + +element.normal.normal { + background-color: @normal-background; + text-color: @normal-foreground; +} + +element.normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; +} + +element.normal.active { + background-color: @active-background; + text-color: @active-foreground; +} + +element.selected.normal { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} + +element.selected.urgent { + background-color: @selected-urgent-background; + text-color: @selected-urgent-foreground; +} + +element.selected.active { + background-color: @selected-active-background; + text-color: @selected-active-foreground; +} + +element.alternate.normal { + background-color: @alternate-normal-background; + text-color: @alternate-normal-foreground; +} + +element.alternate.urgent { + background-color: @alternate-urgent-background; + text-color: @alternate-urgent-foreground; +} + +element.alternate.active { + background-color: @alternate-active-background; + text-color: @alternate-active-foreground; +} + +scrollbar { + width: 4px; + border: 0; + handle-color: @scrollbar-handle; + handle-width: 8px; + padding: 0; +} + +mode-switcher { + border: 2px 0 0; + border-color: @separatorcolor; +} + +inputbar { + spacing: 0; + text-color: @normal-foreground; + padding: 2px; + children: [ prompt, textbox-prompt-sep, entry, case-indicator ]; +} + +case-indicator, +entry, +prompt, +button { + spacing: 0; + text-color: @normal-foreground; +} + +button.selected { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} + +textbox-prompt-sep { + expand: false; + str: ":"; + text-color: @normal-foreground; + margin: 0 0.3em 0 0; +} +element-text, element-icon { + background-color: inherit; + text-color: inherit; +} From 1b77f46457b3be4e5404cb34337d2b1b29de7b49 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Fri, 16 Feb 2024 22:40:04 +0100 Subject: [PATCH 7/7] xmonad: Remove configuration from home --- home/alex/home.nix | 1 - home/alex/programs/xmonad/config.hs | 91 --------------------------- home/alex/programs/xmonad/default.nix | 18 ------ 3 files changed, 110 deletions(-) delete mode 100644 home/alex/programs/xmonad/config.hs delete mode 100644 home/alex/programs/xmonad/default.nix diff --git a/home/alex/home.nix b/home/alex/home.nix index 757cfda..48cc283 100644 --- a/home/alex/home.nix +++ b/home/alex/home.nix @@ -3,7 +3,6 @@ { imports = [ ./cli.nix - ./programs/xmonad ./programs/rofi ./services/polybar ./services/dunst diff --git a/home/alex/programs/xmonad/config.hs b/home/alex/programs/xmonad/config.hs deleted file mode 100644 index 486ac96..0000000 --- a/home/alex/programs/xmonad/config.hs +++ /dev/null @@ -1,91 +0,0 @@ -import XMonad -import XMonad.Util.Ungrab (unGrab) -import XMonad.Layout.ThreeColumns -import XMonad.Layout.Magnifier (magnifiercz') -import XMonad.Hooks.EwmhDesktops -import qualified XMonad.Hooks.ManageDocks as Docks -import qualified XMonad.Util.EZConfig as EZ -import Control.Monad (when) -import Text.Printf (printf) -import System.Posix.Process (executeFile) -import System.Info (arch,os) -import System.Environment (getArgs) -import System.FilePath (()) - -compiledConfig = printf "xmonad-%s-%s" arch os - -compileRestart resume = do - dirs <- asks directories - whenX (recompile dirs True) $ do - when resume writeStateToFile - catchIO - ( do - args <- getArgs - executeFile (cacheDir dirs compiledConfig) False args Nothing - ) - -myLayout = Docks.avoidStruts (tiled ||| Mirror tiled ||| Full ||| columns) - where - tiled = Tall nmaster delta ratio - columns = magnifiercz' 1.3 $ ThreeColMid nmaster delta ratio - nmaster = 1 -- default number of windows in the master pane - ratio = 1/2 -- default proportion occupied by master pane - delta = 3/100 -- percent of screen to increment when resizing - -main :: IO () -main = getDirectories >>= launch myConfig - -myConfig = ewmhFullscreen $ ewmh $ Docks.docks $ def - { modMask = mod4Mask -- Use Super instead of Alt - , terminal = "alacritty" - , layoutHook = myLayout - } - `EZ.additionalKeysP` - [ ("M-S-z", spawn "xscreensaver-command -lock") - , ("M-S-r", compileRestart True) - , ("M-S-q", restart "xmonad" True) - , ("M-C-s", unGrab *> spawn "scrot -s") - , ("M-b", sendMessage Docks.ToggleStruts) - ] - - --- myManageHook :: ManageHook --- myManageHook = composeAll --- [ className =? "Gimp" --> doFloat --- , isDialog --> doFloat --- ] - --- main = xmonad --- . ewmhFullscreen --- . ewmh --- . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey --- $ myConfig - - --- myXmobarPP :: PP --- myXmobarPP = def --- { ppSep = magenta " • " --- , ppTitleSanitize = xmobarStrip --- , ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2 --- , ppHidden = white . wrap " " "" --- , ppHiddenNoWindows = lowWhite . wrap " " "" --- , ppUrgent = red . wrap (yellow "!") (yellow "!") --- , ppOrder = \[ws, l, _, wins] -> [ws, l, wins] --- , ppExtras = [logTitles formatFocused formatUnfocused] --- } --- where --- formatFocused = wrap (white "[") (white "]") . magenta . ppWindow --- formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow - --- -- | Windows should have *some* title, which should not not exceed a --- -- sane length. --- ppWindow :: String -> String --- ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30 - --- blue, lowWhite, magenta, red, white, yellow :: String -> String --- magenta = xmobarColor "#ff79c6" "" --- blue = xmobarColor "#bd93f9" "" --- white = xmobarColor "#f8f8f2" "" --- yellow = xmobarColor "#f1fa8c" "" --- red = xmobarColor "#ff5555" "" --- lowWhite = xmobarColor "#bbbbbb" "" diff --git a/home/alex/programs/xmonad/default.nix b/home/alex/programs/xmonad/default.nix deleted file mode 100644 index 988cd29..0000000 --- a/home/alex/programs/xmonad/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - config.services = { - upower.enable = true; - - xserver = { - windowManager.xmonad = { - enable = true; - enableContribAndExtras = true; - config = ./config.hs; - extraPackages = hp: [ hp.dbus hp.monad-logger hp.xmonad-contrib ]; - }; - }; - }; - - config.systemd.services.upower.enable = true; -}