diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-12-19 15:22:53 -0600 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2025-12-19 15:22:53 -0600 |
| commit | 7fc4bb05905697e6a43fa3805da45768ea9a9858 (patch) | |
| tree | 8d2857bb18ea5808f254e663f6da654313ab94b1 /modules/desktop/hjem | |
| parent | 5a5b183373c3732d96bb834b3ba0fcf2e88e590f (diff) | |
| parent | cdad26dfda64e94d19db576e93793ded9434bd09 (diff) | |
merge from main
Diffstat (limited to 'modules/desktop/hjem')
| -rw-r--r-- | modules/desktop/hjem/default.nix | 2 | ||||
| -rw-r--r-- | modules/desktop/hjem/gtk.nix | 27 | ||||
| -rw-r--r-- | modules/desktop/hjem/programs/foot.nix | 59 | ||||
| -rw-r--r-- | modules/desktop/hjem/programs/research.nix | 47 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/default.nix | 147 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/dunst.nix | 27 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/fuzzel.nix | 28 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/niri.nix | 119 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/sway.nix | 10 |
9 files changed, 390 insertions, 76 deletions
diff --git a/modules/desktop/hjem/default.nix b/modules/desktop/hjem/default.nix index f7dd95e..12623ef 100644 --- a/modules/desktop/hjem/default.nix +++ b/modules/desktop/hjem/default.nix @@ -3,6 +3,8 @@ ./gtk.nix ./wm/sway.nix + ./wm/niri.nix + ./wm/default.nix ./wm/dunst.nix ./wm/fuzzel.nix diff --git a/modules/desktop/hjem/gtk.nix b/modules/desktop/hjem/gtk.nix index 3ea3b37..4665bac 100644 --- a/modules/desktop/hjem/gtk.nix +++ b/modules/desktop/hjem/gtk.nix @@ -22,17 +22,20 @@ in gtk-icon-theme-name = "Papirus"; gtk-theme-name = cfg.theme_data.name; }; - in { - "gtk-3.0/settings.ini" = { - generator = lib.generators.toINI {}; - inherit value; + in + { + "gtk-3.0/settings.ini" = { + generator = lib.generators.toINI {}; + inherit value; + }; + "gtk-4.0/settings.ini" = { + generator = lib.generators.toINI {}; + inherit value; + }; + } + // lib.optionalAttrs (cfg.theme == "catppuccin") { + "gtk-4.0/gtk.css".text = '' + @import url("file://${cfg.theme_data.package}/share/themes/catppuccin-mocha-blue-standard/gtk-4.0/gtk.css"); + ''; }; - "gtk-4.0/settings.ini" = { - generator = lib.generators.toINI {}; - inherit value; - }; - "gtk-4.0/gtk.css".text = '' - @import url("file://${cfg.theme_data.package}/gtk-4.0/gtk.css"); - ''; - }; } diff --git a/modules/desktop/hjem/programs/foot.nix b/modules/desktop/hjem/programs/foot.nix index 4d630c6..c05e22c 100644 --- a/modules/desktop/hjem/programs/foot.nix +++ b/modules/desktop/hjem/programs/foot.nix @@ -12,40 +12,33 @@ shell = "${pkgs.fish}/bin/fish"; }; - colors = { - foreground = "cdd6f4"; - background = "1e1e2e"; - cursor = "11111b f5e0dc"; + colors = with config.collinux.palette; { + alpha = "0.6"; - regular0 = "45475a"; - regular1 = "f38ba8"; - regular2 = "a6e3a1"; - regular3 = "f9e2af"; - regular4 = "89b4fa"; - regular5 = "f5c2e7"; - regular6 = "94e2d5"; - regular7 = "bac2de"; - - bright0 = "585b70"; - bright1 = "f38ba8"; - bright2 = "a6e3a1"; - bright3 = "f9e2af"; - bright4 = "89b4fa"; - bright5 = "f5c2e7"; - bright6 = "94e2d5"; - bright7 = "a6adc8"; - - "16" = "fab387"; - "17" = "f5e0dc"; - - selection-foreground = "cdd6f4"; - selection-background = "414356"; - - search-box-no-match = "11111b f38ba8"; - search-box-match = "cdd6f4 313244"; - - jump-labels = "11111b fab387"; - urls = "89b4fa"; + foreground = base05; + background = base00; + regular0 = base01; + regular1 = base08; + regular2 = base11; + regular3 = base10; + regular4 = base13; + regular5 = base14; + regular6 = base12; + regular7 = base06; + bright0 = base02; + bright1 = base08; + bright2 = base11; + bright3 = base10; + bright4 = base13; + bright5 = base14; + bright6 = base12; + bright7 = base07; + "16" = base09; + "17" = base15; + "18" = base01; + "19" = base02; + "20" = base04; + "21" = base06; }; }; in diff --git a/modules/desktop/hjem/programs/research.nix b/modules/desktop/hjem/programs/research.nix index 3bfde76..1d31479 100644 --- a/modules/desktop/hjem/programs/research.nix +++ b/modules/desktop/hjem/programs/research.nix @@ -11,6 +11,7 @@ in zotero zathura xournalpp + ocrmypdf ]; files = { ".config/xournalpp/toolbar.ini" = { @@ -22,5 +23,51 @@ in }; }; }; + + ".config/zathura/zathurarc".text = lib.mkIf (config.collinux.theme == "adwaita") '' + set font "Iosevka Nerd Font 11.5" + + set recolor 'true' + set recolor-keephue 'false' + set recolor-reverse-video 'false' + + # flipped to make dark mode + set recolor-lightcolor rgba(0,0,0,0) + set recolor-darkcolor '#DEDDDA' + + set completion-fg '#DEDDDA' + set completion-bg '#303030' + set completion-group-fg '#33B2A4' + set completion-group-bg '#303030' + set completion-highlight-fg '#303030' + set completion-highlight-bg '#DEDDDA' + + set default-fg '#DEDDDA' + set default-bg rgba(29,29,29,0.6) + + set inputbar-fg '#DEDDDA' + set inputbar-bg '#303030' + + set notification-fg '#DEDDDA' + set notification-bg '#303030' + set notification-error-fg '#DEDDDA' + set notification-error-bg '#E01B24' + set notification-warning-fg '#DEDDDA' + set notification-warning-bg '#E01B24' + + set statusbar-fg '#DEDDDA' + set statusbar-bg '#303030' + + set highlight-color '#33B2A4' + set highlight-active-color '#33B2A4' + + set render-loading-fg '#DEDDDA' + set render-loading-bg '#303030' + + set index-fg '#DEDDDA' + set index-bg '#303030' + set index-active-fg '#303030' + set index-active-bg '#DEDDDA' + ''; }; } diff --git a/modules/desktop/hjem/wm/default.nix b/modules/desktop/hjem/wm/default.nix new file mode 100644 index 0000000..a5575ad --- /dev/null +++ b/modules/desktop/hjem/wm/default.nix @@ -0,0 +1,147 @@ +{pkgs, ...}: { + files.".config/util.lua" = { + text = let + lua = pkgs.lua.withPackages (p: [p.lua-subprocess]); + in + # lua + '' + #!${lua}/bin/lua + local subprocess = require("subprocess") + + local function get_volume() + local proc, err = subprocess.popen({ + "wpctl", "get-volume", "@DEFAULT_AUDIO_SINK@", + stdout = subprocess.PIPE, + stderr = subprocess.PIPE + }) + if not proc then + error("Failed to run wpctl get-volume: " .. tostring(err)) + end + + local out = proc.stdout:read("*a") or "" + local _, _, code = proc:wait() + if (code or 0) ~= 0 then + local errout = proc.stderr and proc.stderr:read("*a") or "" + error(("wpctl get-volume failed (code %d): %s"):format(code, errout)) + end + + local num = out:match("^Volume:%s*([%d%.]+)") + if not num then + error("Unexpected wpctl output: " .. out) + end + + return tonumber(num) * 100 + end + + local function notify_volume() + local ok, reason, code = subprocess.call({ + "dunstify", "-t", "300", + "-h", "string:x-canonical-private-synchronous:audio", + "Volume:", "-h", "int:value:"..get_volume() + }) + if not ok then + io.stderr:write(("dunstify failed (%s, code %s)\n"):format(reason or "?", code or "?")) + end + end + + local function set_volume(vol) + local ok, reason, code = subprocess.call({ + "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", vol + }) + if not ok then + io.stderr:write(("wpctl set-volume failed (%s, code %s)\n"):format(reason or "?", code or "?")) + end + end + + local function get_brightness() + local proc = subprocess.popen({ + "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "get", + stdout = subprocess.PIPE + }) + if not proc then error("Failed to run brightnessctl get") end + local cur = tonumber(proc.stdout:read("*a")) + proc:wait() + if not cur then error("Failed to parse brightnessctl get output") end + + local proc2 = subprocess.popen({ + "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "max", + stdout = subprocess.PIPE + }) + if not proc2 then error("Failed to run brightnessctl max") end + local max = tonumber(proc2.stdout:read("*a")) + proc2:wait() + if not max or max == 0 then error("Failed to parse brightnessctl max output") end + + return (cur / max) * 100 + end + + local function notify_brightness() + local ok, reason, code = subprocess.call({ + "dunstify", "-t", "300", + "-h", "string:x-canonical-private-synchronous:brightness", + "Brightness", "-h", "int:value:"..get_brightness() + }) + if not ok then + io.stderr:write(("dunstify failed (%s, code %s)\n"):format(reason or "?", code or "?")) + end + end + + local function set_brightness(brightness) + local ok, reason, code = subprocess.call({ + "${pkgs.brightnessctl}/bin/brightnessctl", "-e", "set", brightness + }) + if not ok then + io.stderr:write(("brightnessctl set failed (%s, code %s)\n"):format(reason or "?", code or "?")) + end + end + + local function list_music_players() + local proc = subprocess.popen({ + "${pkgs.playerctl}/bin/playerctl", "-l", + stdout = subprocess.PIPE + }) + if not proc then error("Failed to run playerctl -l") end + + local cur = proc.stdout:lines() + + local out = {} + for i in cur do + table.insert(out, i) + end + + return out + end + + local function toggle_music() + local ok, reason, code = subprocess.call({ + "${pkgs.playerctl}/bin/playerctl", "play-pause", + }) + if not ok then + io.stderr:write(("playerctl play-pause failed (%s, code %s)\n"):format(reason or "?", code or "?")) + end + end + + -- main logic + if arg[2] and arg[2]:match("^(%d+)%%([%+%-])$") then + if arg[1] == "vol" then + set_volume(arg[2]) + notify_volume() + elseif arg[1] == "brightness" then + set_brightness(arg[2]) + notify_brightness() + else + error(("arg[2] '%s' incorrect format. Should look like 5%%+ or 10%%-"):format(tostring(arg[2]))) + end + elseif arg[1] and arg[1] == "music" then + if arg[2] == "play" then + toggle_music() + else + error(("Invalid arg[2]: '%s'. should be `play`"):format(arg[3])) + end + else + error("Unknown command: " .. tostring(arg[1])) + end + ''; + executable = true; + }; +} diff --git a/modules/desktop/hjem/wm/dunst.nix b/modules/desktop/hjem/wm/dunst.nix index 38a8240..9366975 100644 --- a/modules/desktop/hjem/wm/dunst.nix +++ b/modules/desktop/hjem/wm/dunst.nix @@ -4,30 +4,31 @@ pkgs, ... }: let - cfg = config.collinux.desktop.sway.components.dunst; + cfg = config.collinux.desktop.wm.components.dunst; - settings = '' + settings = with config.collinux.palette; '' [global] - frame_color = "#89b4fa" + frame_color = "#ffffff00" separator_color = frame - highlight = "#89b4fa" + + highlight = "#${base13}" + + font = "Iosevka Nerd Font" offset = "(8,8)" origin = "top-right" - transparency = 10 - font = "Iosevka Nerd Font" [urgency_low] - background = "#1e1e2e" - foreground = "#cdd6f4" + background = "#${base00}99" + foreground = "#${base05}ff" [urgency_normal] - background = "#1e1e2e" - foreground = "#cdd6f4" + background = "#${base00}99" + foreground = "#${base05}ff" [urgency_critical] - background = "#1e1e2e" - foreground = "#cdd6f4" - frame_color = "#fab387" + background = "#${base00}99" + foreground = "#${base05}ff" + frame_color = "#${base08}" ''; in lib.mkIf cfg.enable { diff --git a/modules/desktop/hjem/wm/fuzzel.nix b/modules/desktop/hjem/wm/fuzzel.nix index 7b9d075..ab11d6b 100644 --- a/modules/desktop/hjem/wm/fuzzel.nix +++ b/modules/desktop/hjem/wm/fuzzel.nix @@ -4,7 +4,7 @@ pkgs, ... }: let - cfg = config.collinux.desktop.sway.components.fuzzel; + cfg = config.collinux.desktop.wm.components.fuzzel; settings = { main = { @@ -21,21 +21,21 @@ }; border = { radius = 0; - width = 2; + width = 3; }; - colors = { - background = "1e1e2edd"; - text = "cdd6f4ff"; - prompt = "bac2deff"; - placeholder = "7f849cff"; - input = "cdd6f4ff"; - match = "89b4faff"; - selection = "585b70ff"; - selection-text = "cdd6f4ff"; - selection-match = "89b4faff"; - counter = "7f849cff"; - border = "89b4faff"; + colors = with config.collinux.palette; { + background = "${base00}99"; + border = "ffffff00"; + input = base05; + match = base13; + placeholder = base03; + text = base04; + prompt = base04; + + selection = "${base01}5a"; + selection-match = base13; + selection-text = base05; }; }; in diff --git a/modules/desktop/hjem/wm/niri.nix b/modules/desktop/hjem/wm/niri.nix new file mode 100644 index 0000000..4449f82 --- /dev/null +++ b/modules/desktop/hjem/wm/niri.nix @@ -0,0 +1,119 @@ +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.collinux.desktop.wm.niri; +in + lib.mkIf cfg.enable { + files.".config/niri/config.kdl".text = '' + spawn-sh-at-startup "${config.collinux.desktop.wallpaper_cmd}" + spawn-at-startup "${pkgs.playerctl}/bin/playerctld daemon" + spawn-at-startup "dunst" + + prefer-no-csd + environment { + GTK_CSD "1" + } + + output "eDP-1" { + scale 1.0 + } + + input { + focus-follows-mouse + } + + hotkey-overlay { + skip-at-startup + hide-not-bound + } + + binds { + Mod+Q { close-window; } + + Mod+Space { spawn "fuzzel"; } + Mod+Return { spawn "foot"; } + Mod+B { spawn "firefox"; } + + Mod+m { maximize-column; } + + XF86MonBrightnessUp { spawn "~/.config/util.lua" "brightness" "5%+"; } + XF86MonBrightnessDown { spawn "~/.config/util.lua" "brightness" "5%-"; } + XF86AudioRaiseVolume { spawn "~/.config/util.lua" "vol" "5%+"; } + XF86AudioLowerVolume { spawn "~/.config/util.lua" "vol" "5%-"; } + } + + gestures { + hot-corners { + off + } + } + + overview { + zoom 0.66 + workspace-shadow { + off + } + } + + layout { + gaps 12 + + focus-ring { + off + } + + border { + width 3 + active-color "#ffffff00" + inactive-color "#ffffff00" + urgent-color "#ffffff00" + } + + struts { + left 16 + right 16 + top 16 + bottom 16 + } + + background-color "transparent" + } + + layer-rule { + match namespace="^wallpaper$" + place-within-backdrop true + } + + layer-rule { + match namespace="^launcher$" + shadow { + on + } + } + + layer-rule { + match namespace="^notifications$" + shadow { + on + } + } + + window-rule { + match app-id="firefox" + open-maximized true + } + + window-rule { + match is-focused=true + shadow { + on + } + } + + ''; + + packages = [pkgs.niri pkgs.xwayland-satellite]; + } diff --git a/modules/desktop/hjem/wm/sway.nix b/modules/desktop/hjem/wm/sway.nix index 1cd7750..367cd0d 100644 --- a/modules/desktop/hjem/wm/sway.nix +++ b/modules/desktop/hjem/wm/sway.nix @@ -4,7 +4,7 @@ lib, ... }: let - cfg = config.collinux.desktop.sway; + cfg = config.collinux.desktop.wm.sway; colors = '' set $rosewater #f5e0dc @@ -36,7 +36,6 @@ ''; settings = '' - exec ${pkgs.foot}/bin/foot --server exec ${pkgs.swaybg}/bin/swaybg -i ${config.collinux.desktop.wallpaper} exec ${pkgs.dunst}/bin/dunst @@ -74,13 +73,15 @@ bindsym Mod4+Shift+8 move container to workspace number 8 bindsym Mod4+Shift+9 move container to workspace number 9 - bindsym Mod4+Return exec ${pkgs.foot}/bin/footclient - bindsym Mod4+Shift+Return exec ${pkgs.foot}/bin/foot + bindsym Mod4+Return exec ${pkgs.foot}/bin/foot bindsym Mod4+Space exec ${pkgs.fuzzel}/bin/fuzzel bindsym Mod4+b exec ${pkgs.firefox}/bin/firefox bindsym Mod4+Shift+b exec ${pkgs.qutebrowser}/bin/qutebrowser bindsym Mod4+q kill + bindsym Mod4+Shift+s exec '${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" ~/Pictures/$(date +"%s_grim.png")' + bindsym Mod4+Alt+s exec '${pkgs.hyprpicker}/bin/hyprpicker' + bindsym XF86AudioRaiseVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | ${pkgs.bc}/bin/bc)"' bindsym XF86AudioLowerVolume exec 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; dunstify -t 300 -h string:x-canonical-private-synchronous:audio "Volume: " -h "int:value:$(dec=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d\" \" -f2);echo "$dec * 100" | ${pkgs.bc}/bin/bc)"' @@ -106,5 +107,6 @@ in sway brightnessctl playerctl + wl-clipboard ]; } |
