From b831edf9efad11f2a8d49c58e302b8f05b72c95a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 11:51:59 +0100 Subject: l pipewire: pulseaudioLight -> pulseaudio --- lass/2configs/pipewire.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/pipewire.nix b/lass/2configs/pipewire.nix index 24de0e9ed..74da44bd7 100644 --- a/lass/2configs/pipewire.nix +++ b/lass/2configs/pipewire.nix @@ -10,7 +10,7 @@ environment.systemPackages = with pkgs; [ alsaUtils - pulseaudioLight + pulseaudio ponymix ]; -- cgit v1.2.3 From 1877cadb9687456b8ed571bbc44612509fc958f2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 11:52:41 +0100 Subject: l mors.r: foomatic_filters -> foomatic-filters --- lass/2configs/print.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/print.nix b/lass/2configs/print.nix index e2d021641..c2b3e8377 100644 --- a/lass/2configs/print.nix +++ b/lass/2configs/print.nix @@ -3,7 +3,7 @@ services.printing = { enable = true; drivers = [ - pkgs.foomatic_filters + pkgs.foomatic-filters pkgs.gutenprint ]; }; -- cgit v1.2.3 From d6202b1417b67666ba0cb6255b5353204bc21829 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 14:34:06 +0100 Subject: l xmonad: pulseaudioLight -> pulseaudio --- lass/2configs/xmonad.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/xmonad.nix b/lass/2configs/xmonad.nix index 099900d90..495b43372 100644 --- a/lass/2configs/xmonad.nix +++ b/lass/2configs/xmonad.nix @@ -123,9 +123,9 @@ myKeyMap = , ("M4-S-q", restart "xmonad" True) - , ("", spawn "${pkgs.pulseaudioLight.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle") - , ("", spawn "${pkgs.pulseaudioLight.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4%") - , ("", spawn "${pkgs.pulseaudioLight.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4%") + , ("", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-mute @DEFAULT_SINK@ toggle") + , ("", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ +4%") + , ("", spawn "${pkgs.pulseaudio.out}/bin/pactl -- set-sink-volume @DEFAULT_SINK@ -4%") , ("", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -dec 1") , ("", spawn "${pkgs.acpilight}/bin/xbacklight -time 0 -inc 1") , ("M4-C-k", spawn "${pkgs.xorg.xkill}/bin/xkill") -- cgit v1.2.3 From 6b4b555a583933e5428c561f4f861932fd2a8850 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 14:49:58 +0100 Subject: l baseX: ag -> ripgrep --- lass/2configs/baseX.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs') diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 59d1e0182..8680c5ae3 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -55,7 +55,7 @@ in { environment.systemPackages = with pkgs; [ acpi acpilight - ag + ripgrep cabal2nix dic dmenu -- cgit v1.2.3 From 5f317cd595232cbe9729f0ccbde7501f759d66c7 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 15:50:55 +0100 Subject: l baseX: use new fonts config --- lass/2configs/baseX.nix | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 8680c5ae3..249410371 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -96,12 +96,17 @@ in { '') ]; - fonts.fonts = with pkgs; [ - hack-font - hasklig - symbola - xlibs.fontschumachermisc - ]; + fonts = { + fontDir.enable = true; + enableGhostscriptFonts = true; + + fonts = with pkgs; [ + hack-font + xorg.fontschumachermisc + terminus_font_ttf + inconsolata + ]; + }; services.udev.extraRules = '' SUBSYSTEM=="backlight", ACTION=="add", \ -- cgit v1.2.3 From d2556cf5c7d6cc03c12b4ec553e1411c90b3e00e Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Mar 2022 17:03:58 +0100 Subject: l pipwire: add wireplumber workaround for systemWide --- lass/2configs/pipewire.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lass/2configs') diff --git a/lass/2configs/pipewire.nix b/lass/2configs/pipewire.nix index 74da44bd7..f6ccd48d4 100644 --- a/lass/2configs/pipewire.nix +++ b/lass/2configs/pipewire.nix @@ -22,4 +22,15 @@ pulse.enable = true; jack.enable = true; }; + + systemd.services.wireplumber = { + environment = { + HOME = "/var/lib/wireplumber"; + DISPLAY = ":0"; + }; + path = [ + pkgs.dbus + ]; + serviceConfig.StateDirectory = "wireplumber"; + }; } -- cgit v1.2.3 From b14ccba40fdb228859f93ce349aa48905ecdf835 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 25 Mar 2022 13:43:44 +0100 Subject: l hass: add pyscript dev environment --- lass/2configs/hass/default.nix | 1 + lass/2configs/hass/pyscript/.gitignore | 1 + lass/2configs/hass/pyscript/default.nix | 26 +++++++++++++++++ lass/2configs/hass/pyscript/shell.nix | 51 +++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 lass/2configs/hass/pyscript/.gitignore create mode 100644 lass/2configs/hass/pyscript/default.nix create mode 100644 lass/2configs/hass/pyscript/shell.nix (limited to 'lass/2configs') diff --git a/lass/2configs/hass/default.nix b/lass/2configs/hass/default.nix index 8f93e0cec..cc8189f51 100644 --- a/lass/2configs/hass/default.nix +++ b/lass/2configs/hass/default.nix @@ -19,6 +19,7 @@ let in { imports = [ + ./pyscript ./zigbee.nix ./rooms/bett.nix ./rooms/essen.nix diff --git a/lass/2configs/hass/pyscript/.gitignore b/lass/2configs/hass/pyscript/.gitignore new file mode 100644 index 000000000..282debf56 --- /dev/null +++ b/lass/2configs/hass/pyscript/.gitignore @@ -0,0 +1 @@ +hass_token diff --git a/lass/2configs/hass/pyscript/default.nix b/lass/2configs/hass/pyscript/default.nix new file mode 100644 index 000000000..c56967e4b --- /dev/null +++ b/lass/2configs/hass/pyscript/default.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: +{ + systemd.tmpfiles.rules = [ + "L+ /var/lib/hass/custom_components/pyscript - - - - ${pkgs.fetchzip { + url = "https://github.com/custom-components/pyscript/releases/download/1.3.2/hass-custom-pyscript.zip"; + sha256 = "0cqdjj46s5xp4mqxb0ic790jm1xp3z0zr2n9f7bsfl5zpvdshl8z"; + stripRoot = false; + }}" + ]; + + services.home-assistant = { + package = (pkgs.home-assistant.overrideAttrs (old: { + doInstallCheck = false; + })).override { + extraPackages = pp: [ pp.croniter ]; + }; + config.pyscript = { + allow_all_imports = true; + hass_is_global = true; + }; + }; + + networking.firewall.interfaces.retiolum.allowedTCPPortRanges = [ + { from = 50321; to = 50341; } # for ipython interactive debugging + ]; +} diff --git a/lass/2configs/hass/pyscript/shell.nix b/lass/2configs/hass/pyscript/shell.nix new file mode 100644 index 000000000..3cfac0275 --- /dev/null +++ b/lass/2configs/hass/pyscript/shell.nix @@ -0,0 +1,51 @@ +{ pkgs ? import {} }: let + + hass_host = "styx.r"; + hass_token = builtins.readFile ./hass_token; + + mach-nix = import (builtins.fetchGit { + url = "https://github.com/DavHau/mach-nix/"; + ref = "refs/tags/3.4.0"; + }) { + pkgs = pkgs; + }; + pyenv = mach-nix.mkPython { + requirements = '' + hass_pyscript_kernel + ''; + }; + jupyter = import (builtins.fetchGit { + url = https://github.com/tweag/jupyterWith; + ref = "master"; + }) {}; + + pyscriptKernel = { + spec = pkgs.runCommand "pyscript" {} '' + mkdir -p $out/kernels/pyscript + cp ${kernel_json} $out/kernels/pyscript/kernel.json + cp ${pyscript_conf} $out/kernels/pyscript/pyscript.conf + ''; + runtimePackages = [ pyenv ]; + }; + + kernel_json = pkgs.writeText "kernel.json" (builtins.toJSON { + argv = [ + "${pyenv}/bin/python3" "-m" "hass_pyscript_kernel" + "-f" "{connection_file}" + ]; + display_name = "hass_pyscript"; + language = "python"; + }); + + pyscript_conf = pkgs.writeText "pyscript.conf" '' + [homeassistant] + hass_host = ${hass_host} + hass_url = http://''${hass_host}:8123 + hass_token = ${hass_token} + ''; + + jupyterEnvironment = jupyter.jupyterlabWith { + kernels = [ pyscriptKernel ]; + }; + +in jupyterEnvironment.env -- cgit v1.2.3 From b9e0a7ec71e0318a992ff2b275a6aaee3cef63bd Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 28 Mar 2022 17:27:03 +0200 Subject: l fysiirc: strip newlines harder --- lass/2configs/fysiirc.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/fysiirc.nix b/lass/2configs/fysiirc.nix index f3c1d5b7c..e12eda42e 100644 --- a/lass/2configs/fysiirc.nix +++ b/lass/2configs/fysiirc.nix @@ -54,14 +54,20 @@ in { name = "reaktor2-fysiweb-github"; }; script = ''. ${pkgs.writeDash "github-irc" '' - set -efu + set -xefu case "$Method $Request_URI" in "POST /") - payload=$(head -c "$req_content_length" \ - | sed 's/+/ /g;s/%\(..\)/\\x\1/g;' \ - | xargs -0 echo -e \ - ) - echo "$payload" | ${format-github-message}/bin/format-github-message + payload=$(head -c "$req_content_length") + echo "$payload" >&2 + payload2=$payload + payload2=$(echo "$payload" | tr '\n' ' ' | tr -d '\r') + if [ "$payload" != "$payload2" ]; then + echo "payload has been mangled" >&2 + else + echo "payload not mangled" >&2 + fi + echo "$payload2" > /tmp/last_fysi_payload + echo "$payload2" | ${format-github-message}/bin/format-github-message printf 'HTTP/1.1 200 OK\r\n' printf 'Connection: close\r\n' printf '\r\n' -- cgit v1.2.3 From 4ebbfbebf46dc5cd84ed5c51162c08fd2ecf0542 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 4 Apr 2022 18:19:51 +0200 Subject: l: add themes.nix --- lass/2configs/baseX.nix | 1 + lass/2configs/themes.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lass/2configs/themes.nix (limited to 'lass/2configs') diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index 249410371..cbe592d52 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -13,6 +13,7 @@ in { ./pipewire.nix ./tmux.nix ./xmonad.nix + ./themes.nix { krebs.per-user.lass.packages = [ pkgs.sshuttle diff --git a/lass/2configs/themes.nix b/lass/2configs/themes.nix new file mode 100644 index 000000000..dd98b2ef2 --- /dev/null +++ b/lass/2configs/themes.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: let + + switch-theme = pkgs.writers.writeDashBin "switch-theme" '' + if test -e "/etc/themes/$1"; then + ${pkgs.rsync}/bin/rsync --chown=lass:users -a --delete "/etc/themes/$1/" /var/theme/config/ + echo "$1" > /var/theme/current_theme + chown lass:users /var/theme/current_theme + ${pkgs.procps}/bin/pkill -HUP xsettingsd + + else + echo "theme $1 not found" + fi + ''; + +in { + systemd.services.xsettingsd = { + wantedBy = [ "multi-user.target" ]; + environment.DISPLAY = ":0"; + serviceConfig = { + ExecStart = "${pkgs.xsettingsd}/bin/xsettingsd -c /var/theme/config/xsettings.conf"; + User = "lass"; + }; + }; + systemd.tmpfiles.rules = [ + "d /var/theme/ 755 lass users" + ]; + environment.systemPackages = [ + switch-theme + ]; + environment.etc = { + "themes/light/xsettings.conf".text = '' + Net/ThemeName "Adwaita" + ''; + "themes/dark/xsettings.conf".text = '' + Net/ThemeName "Adwaita-dark" + ''; + }; + system.activationScripts.theme.text = '' + if test -e /var/theme/current_theme; then + ${switch-theme}/bin/switch-theme "$(cat /var/theme/current_theme)" || + ${switch-theme}/bin/switch-theme dark + else + ${switch-theme}/bin/switch-theme dark + fi + ''; +} -- cgit v1.2.3 From b3833baee96d7bce2c54295110b40c646468a1ff Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 4 Apr 2022 18:20:15 +0200 Subject: l: configure alacritty --- lass/2configs/alacritty.nix | 99 +++++++++++++++++++++++++++++++++++++++++++++ lass/2configs/baseX.nix | 1 + 2 files changed, 100 insertions(+) create mode 100644 lass/2configs/alacritty.nix (limited to 'lass/2configs') diff --git a/lass/2configs/alacritty.nix b/lass/2configs/alacritty.nix new file mode 100644 index 000000000..a57dc7c25 --- /dev/null +++ b/lass/2configs/alacritty.nix @@ -0,0 +1,99 @@ +{ config, lib, pkgs, ... }: let + + alacritty-cfg = extrVals: builtins.toJSON ({ + font = { + normal = { + family = "Inconsolata"; + style = "Regular"; + }; + bold = { + family = "Inconsolata"; + style = "Bold"; + }; + italic = { + family = "Inconsolata"; + style = "Italic"; + }; + bold_italic = { + family = "Inconsolata"; + style = "Bold Italic"; + }; + size = 8; + }; + live_config_reload = true; + window.dimensions = { + columns = 80; + lines = 20; + }; + # window.opacity = 0; + hints.enabled = [ + { + regex = ''(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\u0000-\u001F\u007F-\u009F<>"\s{-}\^⟨⟩`]+''; + command = "/run/current-system/sw/bin/xdg-open"; + post_processing = true; + mouse.enabled = true; + binding = { + key = "U"; + mods = "Alt"; + }; + } + ]; + } // extrVals); + + alacritty = pkgs.symlinkJoin { + name = "alacritty"; + paths = [ + (pkgs.writeDashBin "alacritty" '' + ${pkgs.alacritty}/bin/alacritty --config-file /var/theme/config/alacritty.yaml "$@" + '') + pkgs.alacritty + ]; + }; + +in { + environment.etc = { + "themes/light/alacritty.yaml".text = alacritty-cfg { + colors = { + # Default colors + primary = { + # hard contrast: background = '#f9f5d7' + # background = "#fbf1c7"; + background = "#f9f5d7"; + # soft contrast: background = '#f2e5bc' + foreground = "#3c3836"; + }; + + # Normal colors + normal = { + black = "#fbf1c7"; + red = "#cc241d"; + green = "#98971a"; + yellow = "#d79921"; + blue = "#458588"; + magenta = "#b16286"; + cyan = "#689d6a"; + white = "#7c6f64"; + }; + + # Bright colors + bright = { + black = "#928374"; + red = "#9d0006"; + green = "#79740e"; + yellow = "#b57614"; + blue = "#076678"; + magenta = "#8f3f71"; + cyan = "#427b58"; + white = "#3c3836"; + }; + }; + }; + "themes/dark/alacritty.yaml".text = alacritty-cfg { + colors.primary = { + background = "#000000"; + foreground = "#ffffff"; + }; + }; + }; + environment.systemPackages = [ alacritty ]; +} diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index cbe592d52..22a3037d7 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -4,6 +4,7 @@ let user = config.krebs.build.user; in { imports = [ + ./alacritty.nix ./mpv.nix ./power-action.nix ./copyq.nix -- cgit v1.2.3 From 83ad464d68217a337c9feb83ce72cf5fe7018f61 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 15 Apr 2022 18:30:06 +0200 Subject: l xmonad: rip xmonad-stockholm --- lass/2configs/xmonad.nix | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/xmonad.nix b/lass/2configs/xmonad.nix index 495b43372..3b372189c 100644 --- a/lass/2configs/xmonad.nix +++ b/lass/2configs/xmonad.nix @@ -5,7 +5,7 @@ enable = true; extraPackages = hs: [ hs.extra - hs.xmonad-stockholm + hs.xmonad-contrib ]; config = /* haskell */ '' {-# LANGUAGE LambdaCase #-} @@ -53,9 +53,6 @@ import XMonad.Util.NamedWindows (getName) import XMonad.Util.Run (safeSpawn) import XMonad.Util.Ungrab (unGrab) -import XMonad.Stockholm.Shutdown (newShutdownEventHandler, shutdown) -import XMonad.Stockholm.Pager (defaultWindowColors, pager, MatchMethod(MatchPrefix), PagerConfig(..)) - data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show) instance UrgencyHook LibNotifyUrgencyHook where @@ -74,15 +71,8 @@ myFont :: String myFont = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1" main :: IO () -main = getArgs >>= \case - [] -> main' - ["--shutdown"] -> shutdown - args -> hPutStrLn stderr ("bad arguments: " <> show args) >> exitFailure - -main' :: IO () -main' = do - handleShutdownEvent <- newShutdownEventHandler - launch $ ewmh +main = do + xmonad $ ewmh $ withUrgencyHook LibNotifyUrgencyHook $ def { terminal = myTerm @@ -94,7 +84,6 @@ main' = do (\path -> forkFile path [] Nothing) , normalBorderColor = "#1c1c1c" , focusedBorderColor = "#ff0000" - , handleEventHook = handleShutdownEvent , workspaces = [ "dashboard", "sys", "wp" ] } `additionalKeysP` myKeyMap @@ -104,6 +93,8 @@ myLayoutHook = defLayout floatHooks = composeAll [ className =? "Pinentry" --> doCenterFloat + , className =? "Pager" --> doCenterFloat + , title =? "pager" --> doCenterFloat , title =? "fzfmenu" --> doCenterFloat , title =? "glxgears" --> doCenterFloat , resource =? "Dialog" --> doFloat @@ -148,8 +139,9 @@ myKeyMap = , ("M4-f", floatNext True) , ("M4-b", spawn "/run/current-system/sw/bin/klem") - , ("M4-v", gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.greedyView) ) - , ("M4-S-v", gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) ) + , ("M4-v", spawn "${pkgs.pager}/bin/pager view") + -- , ("M4-S-v", spawn "${pkgs.pager}/bin/pager shift") + , ("M4-S-v", withWorkspace autoXPConfig (windows . W.shift)) , ("M4-C-v", withWorkspace autoXPConfig (windows . copy)) , ("M4-m", withFocused minimizeWindow) @@ -166,7 +158,7 @@ myKeyMap = , ("M4-", spawn "${pkgs.nm-dmenu}/bin/nm-dmenu") , ("M4-", spawn "${pkgs.writeDash "paste" '' - ${pkgs.coreutils}/bin/sleep 0.1 + ${pkgs.coreutils}/bin/sleep 0.4 ${pkgs.xclip}/bin/xclip -o | ${pkgs.xdotool}/bin/xdotool type -f - ''}") @@ -182,6 +174,7 @@ myKeyMap = , ("M4-", spawn "${pkgs.systemd}/bin/systemctl suspend -i") , ("M4-u", spawn "${pkgs.xcalib}/bin/xcalib -invert -alter") + , ("M4-y", spawn "/run/current-system/sw/bin/switch-theme toggle") , ("M4-s", spawn "${pkgs.knav}/bin/knav") , ("M4-i", spawn "/run/current-system/sw/bin/screenshot") @@ -210,21 +203,6 @@ infixAutoXPConfig = autoXPConfig { searchPredicate = isInfixOf } -pagerConfig :: PagerConfig -pagerConfig = def - { pc_font = myFont - , pc_cellwidth = 64 - , pc_matchmethod = MatchPrefix - , pc_windowColors = windowColors - } - where - windowColors _ _ _ True _ = ("#ef4242","#ff2323") - windowColors wsf m c u wf = do - let y = defaultWindowColors wsf m c u wf - if m == False && wf == True - then ("#402020", snd y) - else y - gridConfig :: GSConfig WorkspaceId gridConfig = def { gs_cellwidth = 100 @@ -234,9 +212,6 @@ gridConfig = def , gs_font = myFont } -allWorkspaceNames :: W.StackSet i l a sid sd -> X [i] -allWorkspaceNames ws = - return $ map W.tag (W.hidden ws ++ (map W.workspace $ W.visible ws)) ++ [W.tag $ W.workspace $ W.current ws] ''; }; } -- cgit v1.2.3 From 4815c90f4d9fe281779f5f474543d62d60be3ab3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 15 Apr 2022 18:42:00 +0200 Subject: l network-manager: disable wait-online --- lass/2configs/network-manager.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'lass/2configs') diff --git a/lass/2configs/network-manager.nix b/lass/2configs/network-manager.nix index 0c59b9592..61bdefab5 100644 --- a/lass/2configs/network-manager.nix +++ b/lass/2configs/network-manager.nix @@ -11,6 +11,7 @@ "vboxnet*" ]; }; + systemd.services.NetworkManager-wait-online.enable = false; users.users.mainUser = { extraGroups = [ "networkmanager" ]; packages = with pkgs; [ -- cgit v1.2.3 From 92d5eacd6d9e530c4d1ea0dec2652417b0fde78a Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 15 Apr 2022 18:42:28 +0200 Subject: l themes: fix startup --- lass/2configs/themes.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lass/2configs') diff --git a/lass/2configs/themes.nix b/lass/2configs/themes.nix index dd98b2ef2..118619c1d 100644 --- a/lass/2configs/themes.nix +++ b/lass/2configs/themes.nix @@ -1,12 +1,18 @@ { config, lib, pkgs, ... }: let switch-theme = pkgs.writers.writeDashBin "switch-theme" '' - if test -e "/etc/themes/$1"; then + set -efux + if [ "$1" = toggle ]; then + if [ "$(${pkgs.coreutils}/bin/cat /var/theme/current_theme)" = dark ]; then + ${placeholder "out"}/bin/switch-theme light + else + ${placeholder "out"}/bin/switch-theme dark + fi + elif test -e "/etc/themes/$1"; then ${pkgs.rsync}/bin/rsync --chown=lass:users -a --delete "/etc/themes/$1/" /var/theme/config/ echo "$1" > /var/theme/current_theme - chown lass:users /var/theme/current_theme + ${pkgs.coreutils}/bin/chown lass:users /var/theme/current_theme ${pkgs.procps}/bin/pkill -HUP xsettingsd - else echo "theme $1 not found" fi @@ -15,6 +21,7 @@ in { systemd.services.xsettingsd = { wantedBy = [ "multi-user.target" ]; + after = [ "display-manager.service" ]; environment.DISPLAY = ":0"; serviceConfig = { ExecStart = "${pkgs.xsettingsd}/bin/xsettingsd -c /var/theme/config/xsettings.conf"; -- cgit v1.2.3