diff --git a/flake.nix b/flake.nix index 43e52bc5..37491ca7 100644 --- a/flake.nix +++ b/flake.nix @@ -53,7 +53,7 @@ in { inherit hostname iosevkaCustom; inherit (plasma-manager.packages.${system}) rc2nix; - accentColourName = "base0C"; + accentColourName = "base0E"; fonts = with iosevkaCustom; rec { sizes = { applications = 12; @@ -91,6 +91,7 @@ }: { networking = {inherit hostName;}; nix.settings.trusted-users = [username]; + services.greetd.settings.initial_session.user = username; programs.${loginShell}.enable = true; users.users.${username} = { shell = pkgs.${loginShell}; diff --git a/home/Northstar.nix b/home/Northstar.nix index 039a8057..8181ac97 100644 --- a/home/Northstar.nix +++ b/home/Northstar.nix @@ -1,4 +1,12 @@ {...}: { imports = [./personal.nix]; - programs.plasma.configFile.kcminputrc."Libinput/1739/52759/SYNA32AA:00 06CB:CE17 Touchpad".NaturalScroll = true; + wayland.windowManager.sway.config = { + output."eDP-1".scale = "1.25"; + workspaceOutputAssign = [ + { + output = "eDP-1"; + workspace = "1"; + } + ]; + }; } diff --git a/home/Scorch.nix b/home/Scorch.nix index 2d7aed4b..82fbce76 100644 --- a/home/Scorch.nix +++ b/home/Scorch.nix @@ -1 +1,6 @@ -{...}: {imports = [./work.nix];} +{...}: { + imports = [./work.nix]; + wayland.windowManager.sway.config = { + output."Dell Inc. DELL P3223QE CCG8YN3".scale = "1.5"; + }; +} diff --git a/home/Tone.nix b/home/Tone.nix index 1cb9ea0d..7fde6f2a 100644 --- a/home/Tone.nix +++ b/home/Tone.nix @@ -1,4 +1,40 @@ {...}: { imports = [./work.nix]; - programs.plasma.configFile.kcminputrc."Libinput/1160/4132/DELL0A21:00 0488:1024 Touchpad".NaturalScroll = true; + wayland.windowManager.sway.config = { + output."eDP-1".scale = "1.25"; + workspaceOutputAssign = [ + { + output = "eDP-1"; + workspace = "1"; + } + ]; + }; + services.kanshi = { + enable = true; + settings = let + laptopScreen = { + criteria = "eDP-1"; + scale = 1.25; + position = "2560,576"; + }; + monitor = { + criteria = "Dell Inc. DELL P3223QE CCG8YN3"; + scale = 1.5; + position = "0,0"; + }; + in [ + { + profile = { + name = "undocked"; + outputs = [laptopScreen]; + }; + } + { + profile = { + name = "docked"; + outputs = [laptopScreen monitor]; + }; + } + ]; + }; } diff --git a/home/Vanguard.nix b/home/Vanguard.nix index ff11b96f..c0661e12 100644 --- a/home/Vanguard.nix +++ b/home/Vanguard.nix @@ -1,7 +1,34 @@ -{...}: { +{pkgs, ...}: { imports = [ ./personal.nix ./games/default.nix ./streaming/default.nix ]; + wayland.windowManager.sway.config = { + output = { + "Microstep MSI G27CQ4 E2 Unknown" = { + mode = "2560x1440@120Hz"; + scale = "1.25"; + position = "1920 0"; + }; + "Acer Technologies ED270R TJMEE0043W01" = { + mode = "1920x1080@120Hz"; + position = "0 140"; + adaptive_sync = "off"; + }; + }; + workspaceOutputAssign = [ + { + output = "DP-1"; + workspace = "2"; + } + { + output = "DP-2"; + workspace = "1"; + } + ]; + startup = [ + {command = "${pkgs.xorg.xrandr}/bin/xrandr --output DP-1 --primary";} + ]; + }; } diff --git a/home/desktop/alacritty/default.nix b/home/desktop/alacritty/default.nix index 647dee1e..4484b513 100644 --- a/home/desktop/alacritty/default.nix +++ b/home/desktop/alacritty/default.nix @@ -19,8 +19,8 @@ x = 10; y = 10; }; - # decorations = "none"; - # opacity = 0.9; + decorations = "none"; + opacity = 0.85; }; live_config_reload = true; selection.save_to_clipboard = true; diff --git a/home/desktop/avizo/default.nix b/home/desktop/avizo/default.nix new file mode 100644 index 00000000..b2b29f7c --- /dev/null +++ b/home/desktop/avizo/default.nix @@ -0,0 +1,19 @@ +{ + config, + accentColourName, + ... +}: { + services.avizo = { + enable = true; + settings.default = let + sc = config.scheme; + rgba = colourName: "${sc."${colourName}-rgb-r"}, ${sc."${colourName}-rgb-g"}, ${sc."${colourName}-rgb-b"}"; + in { + background = "rgba(${rgba "base00"}, 0.9)"; + bar-bg-color = "rgba(${rgba "base00"}, 0.9)"; + bar-fg-color = "rgba(${rgba "base05"}, 1.0)"; + border-color = "rgba(${rgba accentColourName}, 1.0)"; + image-opacity = "1.0"; + }; + }; +} diff --git a/home/desktop/default.nix b/home/desktop/default.nix index 9a3a387d..27393770 100644 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -1,18 +1,98 @@ { config, + lib, pkgs, ... }: { - imports = [./plasma/default.nix]; + imports = [ + ./sway/default.nix + ./foot/default.nix + ./alacritty/default.nix + ./avizo/default.nix + ./fuzzel/default.nix + ./swaylock/default.nix + ./swayidle/default.nix + ./swaync/default.nix + ./waybar/default.nix + ./wlogout/default.nix + ]; home.packages = with pkgs; [ + pinentry + ffmpeg + evince libreoffice-fresh inkscape webcord teams-for-linux - kdePackages.krdc + swayimg + swaybg + (writeShellScriptBin "set-background" '' + ${swaybg}/bin/swaybg -m fill -i ${./wallpapers/landscapes/tropic_island_day.jpg} + '') + (writeShellScriptBin "protonmail-setup-bridge" '' + pkill -9 -f protonmail-bridge + ${protonmail-bridge}/bin/protonmail-bridge -c + swaymsg exec "${protonmail-bridge}/bin/protonmail-bridge -n" + '') + (writeShellScriptBin "davmail-setup" '' + systemctl --user restart davmail # Ensure config file is present + systemctl --user stop davmail + ${davmail}/bin/davmail -n ~/.davmail.properties + systemctl --user restart davmail + '') ]; - services.syncthing.enable = true; + services = { + avizo.enable = true; + gpg-agent.pinentryPackage = pkgs.pinentry-gtk2; + remmina.enable = true; + syncthing.enable = true; + kdeconnect = { + enable = true; + indicator = true; + }; + udiskie = { + enable = true; + notify = true; + automount = true; + tray = "never"; + }; + }; programs.mpv.enable = true; + gtk = { + enable = true; + iconTheme = { + package = pkgs.papirus-icon-theme.override {color = "violet";}; + name = + if config.scheme.variant == "light" + then "Papirus-Light" + else "Papirus-Dark"; + }; + cursorTheme = { + package = pkgs.volantes-cursors; + name = + if config.scheme.variant == "light" + then "volantes_cursors" + else "volantes_light_cursors"; + size = 32; + }; + theme = { + package = pkgs.gnome.gnome-themes-extra; + name = + if config.scheme.variant == "light" + then "Adwaita" + else "Adwaita-dark"; + }; + }; + qt = { + enable = true; + style = { + package = pkgs.adwaita-qt; + name = + if config.scheme.variant == "light" + then "adwaita" + else "adwaita-dark"; + }; + }; xdg = { mime.enable = true; mimeApps = let @@ -20,7 +100,12 @@ in { enable = true; inherit defaultApplications; - associations.added = defaultApplications; + associations = { + added = defaultApplications; + removed = { + "x-scheme-handler/zoomus" = config.xdg.mimeApps.defaultApplications."x-scheme-handler/http"; + }; + }; }; userDirs = { enable = true; @@ -33,9 +118,30 @@ awayOnSystemIdle = true; closeAppOnCross = true; followSystemTheme = true; + electronCLIFlags = lib.mkIf config.wayland.windowManager.sway.enable [["ozone-platform" "wayland"]]; notificationMethod = "electron"; optInTeamsV2 = true; spellCheckerLanguages = ["en_GB"]; }; }; + xresources.properties = with config.scheme.withHashtag; { + "*background" = base00; + "*foreground" = base05; + "*color0" = base00; + "*color1" = red; + "*color2" = green; + "*color3" = yellow; + "*color4" = blue; + "*color5" = magenta; + "*color6" = cyan; + "*color7" = base04; + "*color8" = base01; + "*color9" = red; + "*color10" = green; + "*color11" = yellow; + "*color12" = blue; + "*color13" = magenta; + "*color14" = cyan; + "*color15" = base05; + }; } diff --git a/home/desktop/foot/default.nix b/home/desktop/foot/default.nix new file mode 100644 index 00000000..34e36ba4 --- /dev/null +++ b/home/desktop/foot/default.nix @@ -0,0 +1,47 @@ +{ + config, + fonts, + ... +}: { + programs.foot = { + enable = true; + server.enable = true; + settings = { + main = { + term = "xterm-256color"; + locked-title = false; + font = "${fonts.monospace.name}:size=${toString fonts.sizes.applications}"; + dpi-aware = false; + pad = "10x10"; + }; + bell = { + urgent = false; + notify = false; + visual = false; + }; + cursor = {blink = true;}; + mouse = {hide-when-typing = true;}; + colors = with config.scheme; rec { + alpha = 0.85; + background = base00; + foreground = base05; + regular0 = base02; + regular1 = red; + regular2 = green; + regular3 = yellow; + regular4 = blue; + regular5 = magenta; + regular6 = cyan; + regular7 = base05; + bright0 = base04; + bright1 = regular1; + bright2 = regular2; + bright3 = regular3; + bright4 = regular4; + bright5 = regular5; + bright6 = regular6; + bright7 = base05; + }; + }; + }; +} diff --git a/home/desktop/fuzzel/default.nix b/home/desktop/fuzzel/default.nix new file mode 100644 index 00000000..ebbd5975 --- /dev/null +++ b/home/desktop/fuzzel/default.nix @@ -0,0 +1,46 @@ +{ + config, + pkgs, + fonts, + accentColourName, + ... +}: { + programs.fuzzel = { + enable = true; + settings = { + main = { + dpi-aware = false; + font = "${fonts.monospace.name}:size=${toString fonts.sizes.popups}"; + icon-theme = config.gtk.iconTheme.name; + icons-enabled = true; + fields = "filename,name,generic,categories"; + fuzzy = true; + filter-desktop = true; + terminal = with config.programs; "${ + if alacritty.enable + then alacritty.package + else pkgs.alacritty + }/bin/alacritty -e"; + lines = 24; + width = 80; + tabs = 4; + layer = "overlay"; + }; + colors = let + sc = config.scheme; + in { + background = "${sc.base00}cc"; # 80% Opacity + text = "${sc.base05}ff"; + match = "${sc.red}ff"; + selection = "${sc.base01}ff"; + selection-text = "${sc.base05}ff"; + selection-match = "${sc.red}ff"; + border = "${sc.${accentColourName}}ff"; + }; + border = { + width = 1; + radius = 10; + }; + }; + }; +} diff --git a/home/desktop/mako/default.nix b/home/desktop/mako/default.nix new file mode 100644 index 00000000..1161bb88 --- /dev/null +++ b/home/desktop/mako/default.nix @@ -0,0 +1,26 @@ +{ + config, + fonts, + accentColourName, + ... +}: { + services.mako = let + sc = config.scheme.withHashtag; + in { + enable = true; + anchor = "top-right"; + font = "${fonts.monospace.name} ${toString fonts.sizes.popups}"; + layer = "top"; + markup = true; + maxVisible = 10; + icons = true; + iconPath = with config.gtk.iconTheme; "${package}/share/icons/${name}"; + textColor = "${sc.base05}ff"; + progressColor = "over ${sc.red}ff"; + backgroundColor = "${sc.base00}cc"; + borderColor = "${sc.${accentColourName}}ff"; + borderRadius = 10; + borderSize = 1; + defaultTimeout = 0; + }; +} diff --git a/home/desktop/rofi/default.nix b/home/desktop/rofi/default.nix new file mode 100644 index 00000000..fc1174fd --- /dev/null +++ b/home/desktop/rofi/default.nix @@ -0,0 +1,139 @@ +{ + config, + pkgs, + fonts, + accentColourName, + ... +}: { + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + terminal = with config.programs; "${ + if alacritty.enable + then alacritty.package + else pkgs.alacritty + }/bin/alacritty"; + font = fonts.monospace.name; + location = "center"; + plugins = with pkgs; [rofi-emoji]; + extraConfig = { + modi = "run,drun,ssh,window,emoji,combi"; + combi-modi = "drun,ssh,window,emoji"; + sidebar-mode = true; + sort = true; + sorting-method = "fzf"; + matching = "fuzzy"; + icon-theme = config.gtk.iconTheme.name; + show-icons = true; + application-fallback-icon = "application-x-addon"; + drun-display-format = "{icon} {name} ({categories})"; + disable-history = false; + hide-scrollbar = true; + display-run = " 󰅴 Run "; + display-drun = " 󱓞 Apps "; + display-ssh = " 󰢹 SSH "; + display-window = " 󰧨 Move "; + display-emoji = " 󰞅 Emoji "; + display-combi = " 󰛡 Combi "; + }; + theme = with builtins; let + inherit (config.lib.formats.rasi) mkLiteral; + sc = config.scheme; + bg = mkLiteral "rgba (${sc.base00-rgb-r}, ${sc.base00-rgb-g}, ${sc.base00-rgb-b}, 80%)"; + bg2 = mkLiteral "rgba (${sc.base01-rgb-r}, ${sc.base01-rgb-g}, ${sc.base01-rgb-b}, 100%)"; + fg = mkLiteral sc.withHashtag.base05; + fg2 = mkLiteral sc.withHashtag.base04; + border = mkLiteral sc.withHashtag.${accentColour}; + blue = mkLiteral sc.withHashtag.blue; + in { + "*" = { + background-color = mkLiteral "transparent"; + text-color = fg; + font = with fonts; "${monospace.name} ${toString sizes.popups}"; + }; + + window = { + height = mkLiteral "75%"; + width = mkLiteral "75%"; + border = mkLiteral "1px"; + border-color = border; + border-radius = mkLiteral "10px"; + background-color = bg; + }; + + inputbar = { + children = map mkLiteral ["prompt" "entry"]; + padding = mkLiteral "2px"; + }; + + prompt = { + background-color = bg2; + padding = mkLiteral "6px"; + text-color = blue; + border-radius = mkLiteral "10px"; + margin = mkLiteral "20px 0px 0px 20px"; + }; + + textbox-prompt-colon = { + expand = false; + str = "="; + }; + + entry = { + padding = mkLiteral "6px"; + margin = mkLiteral "20px 0px 0px 10px"; + }; + + listview = { + border = mkLiteral "0px 0px 0px"; + padding = mkLiteral "6px 0px 0px"; + margin = mkLiteral "10px 0px 0px 20px"; + columns = 2; + lines = 5; + }; + + element = { + padding = mkLiteral "5px"; + }; + + "element-icon" = { + size = mkLiteral "25px"; + }; + + "element selected" = { + background-color = bg2; + text-color = blue; + border-radius = mkLiteral "10px"; + }; + + mode-switcher = { + spacing = 0; + }; + + button = { + padding = mkLiteral "10px"; + text-color = fg2; + border-radius = mkLiteral "10px"; + vertical-align = mkLiteral "0.5"; + horizontal-align = mkLiteral "0.5"; + }; + + "button selected" = { + background-color = bg2; + text-color = blue; + }; + + message = { + margin = mkLiteral "2px"; + padding = mkLiteral "2px"; + border-radius = mkLiteral "5px"; + }; + + textbox = { + padding = mkLiteral "6px"; + margin = mkLiteral "20px 0px 0px 20px"; + text-color = blue; + }; + }; + }; +} diff --git a/home/desktop/sway/default.nix b/home/desktop/sway/default.nix new file mode 100644 index 00000000..535a0404 --- /dev/null +++ b/home/desktop/sway/default.nix @@ -0,0 +1,182 @@ +{ + config, + lib, + pkgs, + fonts, + accentColourName, + ... +}: { + programs.waybar.systemd.target = "sway-session.target"; + services.kanshi.systemdTarget = "sway-session.target"; + wayland.windowManager.sway = { + enable = true; + package = + pkgs.swayfx.overrideAttrs + (old: {passthru.providedSessions = ["sway"];}); + swaynag.enable = true; + systemd.enable = true; + xwayland = true; + checkConfig = false; + config = { + input = { + "*" = { + xkb_layout = "gb"; + xkb_options = "ctrl:nocaps"; + }; + "type:touchpad" = { + tap = "enabled"; + natural_scroll = "enabled"; + }; + }; + seat = { + "seat0" = { + xcursor_theme = with config.gtk.cursorTheme; "${name} ${toString size}"; + }; + }; + modifier = "Mod4"; + terminal = "${config.programs.alacritty.package}/bin/alacritty"; + menu = "${config.programs.fuzzel.package}/bin/fuzzel"; + workspaceAutoBackAndForth = true; + bars = []; + gaps = { + inner = 5; + outer = 0; + }; + fonts = { + names = [fonts.monospace.name]; + style = "regular"; + size = fonts.sizes.desktop * 1.0; + }; + colors = let + sc = config.scheme.withHashtag; + text = toString sc.base05; + indicator = toString sc.${accentColourName}; + background = toString sc.base00; + in { + inherit background; + focused = let + border = toString sc.${accentColourName}; + in { + inherit background text indicator border; + childBorder = border; + }; + focusedInactive = let + border = toString sc.base04; + in { + inherit background text indicator border; + childBorder = border; + }; + unfocused = let + border = toString sc.base03; + in { + inherit background text indicator border; + childBorder = border; + }; + urgent = let + border = toString sc.red; + in { + inherit background text indicator border; + childBorder = border; + }; + }; + startup = [ + {command = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";} + {command = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";} + {command = "set-background";} + ]; + window = { + border = 1; + titlebar = false; + commands = [ + { + criteria.window_role = "(?:pop-up|bubble|dialog)"; + command = "floating enable"; + } + { + criteria.app_id = "(?:org\.kde\.polkit-kde-authentication-agent-1|Pinentry|pavucontrol|\.blueman-manager-wrapped|nm-connection-editor)"; + command = "floating enable"; + } + { + criteria.class = "(?:[Mm]atplotlib|.*\.py|Idl)"; + command = "floating enable"; + } + { + # Catch-all for file dialog windows + criteria.title = "(?:Open|Save) (?:File|Folder|As)"; + command = "floating enable, resize set width 1030 height 710"; + } + { + # Inhibit idle when watching vidoes + criteria.app_id = "(?:firefox|mpv)"; + command = "inhibit_idle fullscreen"; + } + { + # Window rules for game sessions. + # Note: controllers don't reset idle timer + criteria.class = "(?:steam_app|Minecraft).*"; + command = "floating enable, fullscreen enable, inhibit_idle focus"; + } + ]; + }; + floating.border = 1; + keybindings = with config; let + modifier = wayland.windowManager.sway.config.modifier; + in + lib.mkOptionDefault { + # Movement + "${modifier}+comma" = "workspace prev"; + "${modifier}+period" = "workspace next"; + "${modifier}+shift+comma" = "move workspace prev"; + "${modifier}+shift+period" = "move workspace next"; + "${modifier}+bracketleft" = "move workspace to output left"; + "${modifier}+bracketright" = "move workspace to output right"; + + # Function keys + ## Sound + "XF86AudioMute" = "exec ${services.avizo.package}/bin/volumectl %"; + "XF86AudioMicMute" = "exec ${services.avizo.package}/bin/volumectl -m %"; + "XF86AudioRaiseVolume" = "exec ${services.avizo.package}/bin/volumectl -u + 5"; + "XF86AudioLowerVolume" = "exec ${services.avizo.package}/bin/volumectl -u - 5"; + + ## Playback + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + + ## Brightness + "XF86MonBrightnessUp" = "exec ${services.avizo.package}/bin/lightctl + 5"; + "XF86MonBrightnessDown" = "exec ${services.avizo.package}/bin/lightctl - 5"; + + # System utilities + "Mod4+Mod1+l" = "exec swaylockfx"; + "${modifier}+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw"; + "${modifier}+Shift+z" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw"; + "${modifier}+Shift+p" = "exec ${programs.wlogout.package}/bin/wlogout"; + "${modifier}+Shift+Return" = "exec ${programs.emacs.finalPackage}/bin/emacsclient -c"; + }; + }; + extraConfig = '' + bindgesture swipe:right workspace prev + bindgesture swipe:left workspace next + corner_radius 10 + blur enable + blur_xray disable + blur_passes 3 + blur_radius 5 + corner_radius 10 + shadows disable + shadow_blur_radius 0 + layer_effects "system-menu" blur enable; shadows disable + layer_effects "gtk-layer-shell" blur enable; shadows disable + layer_effects "notifications" blur enable; shadows disable + layer_effects "launcher" blur enable; shadows disable + layer_effects "logout_dialog" blur enable; shadows disable + layer_effects "waybar" blur enable; shadows disable + layer_effects "avizo" blur enable; shadows disable + layer_effects "swaync-notification-window" blur enable; shadows disable + layer_effects "swaync-control-center" blur enable; shadows disable + titlebar_separator enable + ''; + }; +} diff --git a/home/desktop/swayidle/default.nix b/home/desktop/swayidle/default.nix new file mode 100644 index 00000000..469e6572 --- /dev/null +++ b/home/desktop/swayidle/default.nix @@ -0,0 +1,20 @@ +{ + config, + pkgs, + ... +}: { + imports = [../swaylock/default.nix]; + services.swayidle = let + swaylockfx = + pkgs.callPackage ../swaylock/swaylockfx.nix + {swaylock-effects = config.programs.swaylock.package;}; + in { + enable = true; + timeouts = [ + { + timeout = 60 * 15; # 15 minutes + command = "${swaylockfx}/bin/swaylockfx"; + } + ]; + }; +} diff --git a/home/desktop/swaylock/default.nix b/home/desktop/swaylock/default.nix new file mode 100644 index 00000000..af8dfded --- /dev/null +++ b/home/desktop/swaylock/default.nix @@ -0,0 +1,48 @@ +{ + config, + pkgs, + accentColourName, + ... +}: { + home.packages = with pkgs; [ + (callPackage ./swaylockfx.nix + {swaylock-effects = config.programs.swaylock.package;}) + ]; + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + # Settings are specifically for swaylock-effects + settings = let + sc = config.scheme; + in { + indicator-radius = 100; + indicator-thickness = 10; + indicator-caps-lock = true; + ignore-empty-password = true; + show-failed-attempts = true; + effect-blur = "5x3"; + effect-vignette = "0.5:0.5"; + grace = 2; + fade-in = 0.2; + bs-hl-color = sc.base06; + caps-lock-bs-hl-color = sc.base06; + caps-lock-key-hl-color = sc.green; + inside-color = "${sc.base00}cc"; + key-hl-color = sc.green; + layout-bg-color = "${sc.base00}cc"; + layout-border-color = sc.${accentColourName}; + layout-text-color = sc.base05; + ring-color = sc.${accentColourName}; + ring-clear-color = sc.base06; + ring-caps-lock-color = sc.base09; + ring-ver-color = sc.blue; + ring-wrong-color = sc.red; + separator-color = sc.base01; + text-color = sc.base05; + text-clear-color = sc.base06; + text-caps-lock-color = sc.base09; + text-ver-color = sc.blue; + text-wrong-color = sc.red; + }; + }; +} diff --git a/home/desktop/swaylock/swaylockfx.nix b/home/desktop/swaylock/swaylockfx.nix new file mode 100644 index 00000000..0a4353ba --- /dev/null +++ b/home/desktop/swaylock/swaylockfx.nix @@ -0,0 +1,6 @@ +{ + writeShellScriptBin, + swaylock-effects, + ... +}: +writeShellScriptBin "swaylockfx" "${swaylock-effects}/bin/swaylock --screenshots --clock --indicator --grace-no-mouse" diff --git a/home/desktop/swaync/default.nix b/home/desktop/swaync/default.nix new file mode 100644 index 00000000..102a9836 --- /dev/null +++ b/home/desktop/swaync/default.nix @@ -0,0 +1,360 @@ +{ + config, + pkgs, + fonts, + accentColourName, + ... +}: { + home.packages = [pkgs.swaynotificationcenter]; + xdg.configFile."swaync/style.css".text = let + sc = config.scheme.withHashtag; + alpha = "0.85"; + alpha-background = "rgba(${config.scheme.base00-rgb-r}, ${config.scheme.base00-rgb-g}, ${config.scheme.base00-rgb-b}, ${alpha})"; + in '' + * { + all: unset; + font-size: 1.2rem; + font-family: "${fonts.monospace.name}"; + transition: 200ms; + box-shadow: none; + } + + .floating-notifications.background .notification-row .notification-background { + border-radius: 10px; + border: 1px solid ${sc.${accentColourName}}; + margin: 18px; + background-color: ${alpha-background}; + color: ${sc.base05}; + padding: 0; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification { + padding: 7px; + border-radius: 10px; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: ${sc.base05}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .time { + color: ${sc.base04}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + .notification-content + .body { + color: ${sc.base05}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * { + min-height: 3.4em; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action { + border-radius: 10px; + background-color: ${sc.base01}; + color: ${sc.base05}; + margin: 7px; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + background-color: ${sc.base01}; + color: ${sc.base05}; + } + + .floating-notifications.background + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + background-color: ${sc.blue}; + color: ${sc.base00}; + } + + .floating-notifications.background + .notification-row + .notification-background + .close-button { + margin: 7px; + padding: 2px; + border-radius: 10px; + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .floating-notifications.background + .notification-row + .notification-background + .close-button:hover { + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .floating-notifications.background + .notification-row + .notification-background + .close-button:active { + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .control-center { + border-radius: 10px; + border: 1px solid ${sc.${accentColourName}}; + margin: 18px; + background-color: ${alpha-background}; + color: ${sc.base05}; + padding: 14px; + } + + .control-center .widget-title { + color: ${sc.base05}; + font-size: 1.3em; + } + + .control-center .widget-title button { + border-radius: 7px; + background-color: ${sc.base01}; + color: ${sc.base05}; + padding: 8px; + } + + .control-center .widget-title button:hover { + background-color: ${sc.base02}; + color: ${sc.base05}; + } + + .control-center .widget-title button:active { + background-color: ${sc.base03}; + color: ${sc.base05}; + } + + .control-center .notification-row .notification-background { + border-radius: 10px; + background-color: ${sc.base01}; + color: ${sc.base05}; + margin-top: 14px; + } + + .control-center .notification-row .notification-background .notification { + padding: 7px; + border-radius: 7px; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content { + margin: 7px; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .summary { + color: ${sc.base05}; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .time { + color: ${sc.base04}; + } + + .control-center + .notification-row + .notification-background + .notification + .notification-content + .body { + color: ${sc.base05}; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * { + min-height: 3.4em; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action { + border-radius: 7px; + background-color: ${sc.base00}; + color: ${sc.base05}; + margin: 7px; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:hover { + background-color: ${sc.base01};; + color: ${sc.base05}; + } + + .control-center + .notification-row + .notification-background + .notification + > *:last-child + > * + .notification-action:active { + background-color: ${sc.blue}; + color: ${sc.base05}; + } + + .control-center .notification-row .notification-background .close-button { + margin: 7px; + padding: 2px; + border-radius: 6.3px; + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .control-center .notification-row .notification-background .close-button:hover { + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .control-center + .notification-row + .notification-background + .close-button:active { + background-color: ${sc.red}; + color: ${sc.base00}; + } + + .control-center .notification-row .notification-background:hover { + background-color: ${sc.base00}; + color: ${sc.base05}; + } + + .control-center .notification-row .notification-background:active { + background-color: ${sc.blue}; + color: ${sc.base05}; + } + + progressbar, + progress, + trough { + border-radius: 12.6px; + } + + .notification.critical progress { + background-color: ${sc.red}; + } + + .notification.low progress, + .notification.normal progress { + background-color: ${sc.blue}; + } + + trough { + background-color: ${sc.base00}; + } + + .control-center trough { + background-color: ${sc.base03}; + } + + .control-center-dnd { + margin-top: 5px; + border-radius: 8px; + background: ${sc.base00}; + border: 1px solid ${sc.base03}; + } + + .control-center-dnd:checked { + background: ${sc.base00}; + } + + .control-center-dnd slider { + background: ${sc.base03}; + border-radius: 8px; + } + + .widget-dnd { + margin: 0px; + font-size: 1.1rem; + } + + .widget-dnd > switch { + font-size: initial; + border-radius: 8px; + background: ${sc.base00}; + border: 1px solid ${sc.base03}; + } + + .widget-dnd > switch:checked { + background: ${sc.base00}; + } + + .widget-dnd > switch slider { + background: ${sc.base01}; + border-radius: 8px; + border: 1px solid ${sc.${accentColourName}}; + } + + ''; +} diff --git a/home/desktop/waybar/default.nix b/home/desktop/waybar/default.nix new file mode 100644 index 00000000..907a39c6 --- /dev/null +++ b/home/desktop/waybar/default.nix @@ -0,0 +1,345 @@ +{ + config, + pkgs, + fonts, + accentColourName, + ... +}: { + systemd.user.targets.tray.Unit = { + Description = "Home Manager System Tray"; + Requires = ["graphical-session.target"]; + }; + programs.waybar = { + enable = true; + systemd.enable = true; + settings.main = { + name = "main"; + layer = "top"; + position = "bottom"; + # Layout + "modules-left" = [ + "sway/workspaces" + "sway/window" + ]; + "modules-center" = []; + "modules-right" = [ + "mpris" + "custom/notification" + "pulseaudio" + "network" + "bluetooth" + "clock#calendar" + "clock" + "backlight" + "battery" + "custom/weather" + "tray" + ]; + # Module config + "sway/workspaces" = { + format = "{icon}"; + format-icons = { + "1" = "󰫃 "; + "2" = "󰫄 "; + "3" = "󰫅 "; + "4" = "󰫆 "; + "5" = "󰫇 "; + "6" = "󰫈 "; + default = "󰋙 "; + urgent = "󰁡 "; + }; + all-outputs = false; + persistent-workspaces = { + "1" = []; + "2" = []; + "3" = []; + "4" = []; + "5" = []; + "6" = []; + }; + }; + "sway/window" = { + "format" = "{title}"; + "max-length" = 50; + "rewrite" = { + "(.*) - GNU Emacs at (.*)" = " $1 [$2]"; + "(alacritty.*)" = " $1"; + "(foot.*)" = " $1"; + "(.*) - mpv" = "󰦟 $1"; + "swayimg: (.*)" = "󰋩 $1"; + "(btm)" = " Resource Usage [$1]"; + "(cava)" = "󰝚 Music Visualiser [$1]"; + "(.*) - Thunar" = "󰝰 $1"; + "Mozilla Firefox" = "󰈹 $1"; + "(.*) — Mozilla Firefox" = "󰈹 $1"; + "Nyxt - (.*)" = "󰀹 $1"; + "(.*) - Chromium" = "󰊯 $1"; + "(Signal.*)" = "󰭹 $1"; + "((?:.*)WebCord.*)" = "󰙯 $1"; + "(Cartridges.*)" = "󰊗 $1"; + "([Ss]team.*)" = "󰓓 $1"; + "(Prism Launcher.*)" = "󰍳 Minecraft ($1)"; + "(X2Go Client)" = "󰢹 $1"; + "(NoMachine|Nxplayer.bin) (.*)" = "󰢹 $1 $2"; + }; + }; + mpris = { + "format" = "{status_icon} {player_icon} {artist} - {title}"; + "tooltip-format" = "{player_icon} ({player}) {dynamic}"; + "title-len" = 64; + "interval" = 1; + "dynamic-order" = [ + "album" + "artist" + "title" + "position" + "length" + ]; + "player-icons" = { + "default" = "󰲸 "; + "emms" = " "; + "firefox" = "󰈹 "; + "mpv" = "󰦟 "; + }; + "status-icons" = { + "playing" = "󰐊"; + "paused" = "󰏤"; + "stopped" = "󰓛"; + }; + "ignored-players" = []; + }; + pulseaudio = { + scroll-step = 5; + format = "{format_source}{icon}{volume}%"; + format-muted = "{format_source} 󰝟 "; + format-source = "󰍬 "; + format-source-muted = "󰍭 "; + format-icons = { + car = "󰄍 "; + default = ["󰕿 " "󰖀 " "󰕾 "]; + hands-free = "󰥰 "; + headset = "󰋎 "; + phone = "󰏲 "; + portable = "󰏳 "; + headphone = "󰋋 "; + }; + on-click = "${pkgs.pavucontrol}/bin/pavucontrol"; + on-click-right = "${pkgs.pamixer}/bin/pamixer -t"; + on-scroll-up = "${pkgs.pamixer}/bin/pamixer -i 5"; + on-scroll-down = "${pkgs.pamixer}/bin/pamixer -d 5"; + }; + disk = { + format = "󰋊 {percentage_used}%"; + path = config.home.homeDirectory; + }; + cpu = { + format = "󰻠 {usage}%"; + tooltip = false; + }; + memory = {format = "󰍛 {}%";}; + temperature = { + critical-threshold = 80; + format = "{icon} {temperatureC}°C"; + format-icons = ["󱃃" "󰔏" "󱃂"]; + }; + network = { + format-icons = ["󰤟 " "󰤢 " "󰤥 " "󰤨 "]; + format-wifi = "{icon}"; + format-ethernet = "󰈁 "; + tooltip-format = "{essid} ({signalStrength}%)"; + format-linked = "󰈂 "; + format-disconnected = "󰈂 "; + }; + bluetooth = { + format = "󰂯"; + format-disabled = "󰂲"; + format-off = "󰂲"; + format-on = "󰂯"; + format-connected = "󰂱"; + tooltip-format = "{status} | {device_alias}"; + on-click = "${pkgs.bluez}/bin/bluetoothctl power on"; + on-click-right = "${pkgs.bluez}/bin/bluetoothctl power off"; + }; + "clock#calendar" = { + # format = "{:󰃭 %Y-%m-%d}"; + format = "{:%Y-%m-%d}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021 + tooltip-format = "{calendar}"; + calendar = { + mode = "month"; + mode-mon-col = 3; + weeks-pos = "left"; + on-scroll = 1; + on-click-right = "mode"; + format = { + months = "{}"; + days = "{}"; + weeks = "W{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + actions = { + on-click-right = "mode"; + on-scroll-up = "shift_up"; + on-scroll-down = "shift_down"; + }; + }; + clock = { + # format = "{:󰥔 %R}"; + format = "{:%R}"; # TEMP, see https://github.com/Alexays/Waybar/issues/3021 + }; + backlight = { + format = "{icon}"; + tooltip-format = "{percent}%"; + format-icons = [" " " " " " " " " " " " " " " " " "]; + }; + battery = { + states = { + warning = 30; + critical = 20; + }; + format = "{icon}"; + format-charging = "󰂄 "; + format-plugged = "󰚥 "; + tooltip-format = "{capacity}% {time}"; + format-icons = ["󱃍 " "󰁺 " "󰁻 " "󰁼 " "󰁽 " "󰁾 " "󰁿 " "󰂀 " "󰂁 " "󰂂 " "󰁹 "]; + }; + "custom/notification" = let + swaync = pkgs.swaynotificationcenter; + in { + "tooltip" = false; + "format" = "{icon}{}"; + "format-icons" = { + "notification" = "󱅫 "; + "none" = "󰂚 "; + "dnd-notification" = "󰅸 "; + "dnd-none" = "󰂜 "; + "inhibited-notification" = "󰅸 "; + "inhibited-none" = "󰂜 "; + "dnd-inhibited-notification" = "󰅸 "; + "dnd-inhibited-none" = "󰂜 "; + }; + "return-type" = "json"; + "exec-if" = "which ${swaync}/bin/swaync-client"; + "exec" = "${swaync}/bin/swaync-client -swb"; + "on-click" = "${swaync}/bin/swaync-client -t -sw"; + "on-click-right" = "${swaync}/bin/swaync-client -d -sw"; + "escape" = true; + }; + "custom/weather" = let + date-format = "%Y-%m-%d"; + custom-indicator = "{ICON}{temp_C}({FeelsLikeC})"; + in { + format = "{}°"; + tooltip = true; + interval = 900; # Every 15 minutes + exec = ''${pkgs.wttrbar}/bin/wttrbar --location Didcot --date-format "${date-format}" --custom-indicator "${custom-indicator}"''; + return-type = "json"; + }; + tray = { + icon-size = builtins.floor fonts.sizes.popups; + show-passive-items = true; + spacing = 5; + }; + }; + style = let + sc = config.scheme.withHashtag; + alpha = "0.85"; + in '' + * { + all: unset; + font-size: ${toString (builtins.floor (builtins.div fonts.sizes.popups 10))}em; + font-family: ${fonts.monospace.name}; + } + + window { + background: transparent; + box-shadow: none; + } + + window > box { + color: ${sc.base05}; + background: alpha(${sc.base00}, ${alpha}); + margin: 0px 5px 5px; + padding: 0px; + border-top: 1px solid ${sc.base04}; + border-radius: 10px; + } + + tooltip { + background: ${sc.base00}; + border: 1px solid ${sc.${accentColourName}}; + border-radius: 10px; + box-shadow: none; + } + + tooltip label { + color: ${sc.base05}; + border: none; + padding: 5px; + margin: 0px; + } + + #workspaces, + #window, + #mpris, + #pulseaudio, + #network, + #bluetooth, + #backlight, + #battery, + #clock, + #custom-notification, + #custom-weather, + #tray { + margin: 0px; + padding: 1px 5px; + } + + #workspaces, + #window, + #mpris, + #tray, + #backlight, + #battery, + #custom-weather { + color: ${sc.base05}; + } + + #workspaces button { + background: transparent; + color: ${sc.base05}; + margin: 0px; + padding: 0px 5px; + } + #workspaces button.persistent { + color: ${sc.base03}; + } + #workspaces button.focused { + color: ${sc.${accentColourName}}; + } + #workspaces button.urgent { + color: ${sc.base09}; + } + + #custom-notification { + color: ${sc.base08}; + } + #pulseaudio { + color: ${sc.base09}; + } + #network { + color: ${sc.base0A}; + } + #bluetooth { + color: ${sc.base0B}; + } + #clock.calendar { + color: ${sc.base0C}; + } + #clock { + color: ${sc.base0D}; + } + ''; + }; +} diff --git a/home/desktop/wlogout/default.nix b/home/desktop/wlogout/default.nix new file mode 100644 index 00000000..730d0025 --- /dev/null +++ b/home/desktop/wlogout/default.nix @@ -0,0 +1,77 @@ +{ + config, + fonts, + ... +}: { + programs.wlogout = { + enable = true; + layout = [ + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + { + label = "logout"; + action = "swaymsg exit"; + text = "Logout"; + keybind = "l"; + } + ]; + style = let + sc = config.scheme.withHashtag; + shutdownIcon = ./icons/shutdown.png; + rebootIcon = ./icons/reboot.png; + logoutIcon = ./icons/logout.png; + in '' + * { + font-size: ${toString fonts.sizes.popups}px; + font-family: "${fonts.sansSerif.name}"; + } + + window { + border: none; + background-color: transparent; + } + + button { + background-color: ${sc.base00}; + background-repeat: no-repeat; + background-position: center; + background-size: 25%; + box-shadow: none; + margin: 5px; + color: ${sc.base05}; + } + + button:hover { + background-color: ${sc.base01}; + color: ${sc.base05}; + } + + button:focus { + background-color: ${sc.base02}; + color: ${sc.base05}; + } + + #shutdown { + background-image: url("${shutdownIcon}"); + } + + #reboot { + background-image: url("${rebootIcon}"); + } + + #logout { + background-image: url("${logoutIcon}"); + } + ''; + }; +} diff --git a/home/desktop/wlogout/icons/hibernate.png b/home/desktop/wlogout/icons/hibernate.png new file mode 100644 index 00000000..a6322aa2 Binary files /dev/null and b/home/desktop/wlogout/icons/hibernate.png differ diff --git a/home/desktop/wlogout/icons/lock.png b/home/desktop/wlogout/icons/lock.png new file mode 100644 index 00000000..f0b1eaf9 Binary files /dev/null and b/home/desktop/wlogout/icons/lock.png differ diff --git a/home/desktop/wlogout/icons/logout.png b/home/desktop/wlogout/icons/logout.png new file mode 100644 index 00000000..345a8aa8 Binary files /dev/null and b/home/desktop/wlogout/icons/logout.png differ diff --git a/home/desktop/wlogout/icons/reboot.png b/home/desktop/wlogout/icons/reboot.png new file mode 100644 index 00000000..29cfa2ff Binary files /dev/null and b/home/desktop/wlogout/icons/reboot.png differ diff --git a/home/desktop/wlogout/icons/shutdown.png b/home/desktop/wlogout/icons/shutdown.png new file mode 100644 index 00000000..4d7d4995 Binary files /dev/null and b/home/desktop/wlogout/icons/shutdown.png differ diff --git a/home/desktop/wlogout/icons/suspend.png b/home/desktop/wlogout/icons/suspend.png new file mode 100644 index 00000000..647bd663 Binary files /dev/null and b/home/desktop/wlogout/icons/suspend.png differ diff --git a/home/emacs/default.nix b/home/emacs/default.nix index ae79ee96..c8d73125 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -27,6 +27,7 @@ fixed-font-family = "${fonts.monospace.name}"; variable-font-family = "${fonts.sansSerif.name}"; font-height = builtins.toString (builtins.floor (builtins.mul fonts.sizes.applications 10)); + alpha = "85"; custom-theme-name = "nix"; custom-theme = pkgs.writeTextFile { name = "custom-emacs-theme"; @@ -51,6 +52,8 @@ }; custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el"; in '' + (add-to-list 'initial-frame-alist '(alpha-background . ${alpha})) + (add-to-list 'default-frame-alist '(alpha-background . ${alpha})) (add-to-list 'custom-theme-load-path "${custom-theme}") (add-to-list 'custom-safe-themes "${custom-theme-hash}") (load-theme '${custom-theme-name}) diff --git a/system/desktop.nix b/system/desktop.nix index 16b4139a..344a5ff8 100644 --- a/system/desktop.nix +++ b/system/desktop.nix @@ -9,27 +9,71 @@ system.autoUpgrade.operation = "boot"; hardware.bluetooth.enable = true; environment = { - plasma6 = - lib.mkIf config.services.desktopManager.plasma6.enable - {excludePackages = with pkgs.kdePackages; [plasma-browser-integration];}; + sessionVariables = { + NIXOS_OZONE_WL = "1"; + GRIM_DEFAULT_DIR = "$HOME/Pictures/Grim"; + }; systemPackages = with pkgs; [ xdg-utils + wtype + wl-clipboard + libnotify + libcamera + glib + gsettings-desktop-schemas hunspell hunspellDicts.en_GB-large + pamixer + pavucontrol + playerctl + brightnessctl ]; }; + security = { + polkit.enable = true; + pam.services.swaylock = {}; + }; programs = { dconf.enable = true; + light.enable = true; noisetorch.enable = true; kdeconnect.enable = true; + file-roller.enable = true; + thunar = { + enable = true; + plugins = with pkgs.xfce; [thunar-archive-plugin thunar-volman]; + }; + sway = { + enable = true; + package = + pkgs.swayfx.overrideAttrs + (old: {passthru.providedSessions = ["sway"];}); + wrapperFeatures.gtk = true; + }; gamescope = { enable = true; capSysNice = true; }; + xwayland.enable = true; + }; + gtk.iconCache.enable = true; + qt = { + enable = true; + platformTheme = "gnome"; + style = "adwaita"; }; services = { + dbus.packages = with pkgs; [gcr]; flatpak.enable = true; + blueman.enable = true; printing.enable = true; + accounts-daemon.enable = true; + tumbler.enable = true; + udisks2.enable = true; + gvfs = { + enable = true; + package = lib.mkForce pkgs.gnome3.gvfs; + }; pipewire = { enable = true; pulse.enable = true; @@ -38,21 +82,27 @@ support32Bit = true; }; }; - xserver = { + greetd = { enable = true; + settings = let + command = "sway"; + in { + initial_session = {inherit command;}; + default_session = {inherit command;}; + }; + }; + xserver = { + enable = false; xkb = { layout = "gb"; variant = ""; options = "ctrl:nocaps"; }; }; - displayManager.sddm = { - enable = true; - wayland.enable = true; - }; - desktopManager.plasma6 = { - enable = true; - enableQt5Integration = true; - }; + }; + xdg.portal = { + enable = true; + config.common.default = "*"; # TODO change for xdg-desktop-portal > 1.17 changes + extraPortals = [pkgs.xdg-desktop-portal-gtk]; }; }