aboutsummaryrefslogtreecommitdiff
path: root/snowfall/modules/home/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'snowfall/modules/home/desktop')
-rw-r--r--snowfall/modules/home/desktop/components/i3/default.nix256
-rw-r--r--snowfall/modules/home/desktop/components/picom/default.nix30
-rw-r--r--snowfall/modules/home/desktop/components/polybar/default.nix278
-rw-r--r--snowfall/modules/home/desktop/components/rofi/default.nix58
-rw-r--r--snowfall/modules/home/desktop/default.nix1
5 files changed, 623 insertions, 0 deletions
diff --git a/snowfall/modules/home/desktop/components/i3/default.nix b/snowfall/modules/home/desktop/components/i3/default.nix
new file mode 100644
index 0000000..93542f0
--- /dev/null
+++ b/snowfall/modules/home/desktop/components/i3/default.nix
@@ -0,0 +1,256 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.desktop.components.i3;
+ desktop = config.${namespace}.desktop;
+in {
+ options.${namespace}.desktop.components.i3 = with types; {
+ enable = mkEnableOption "i3";
+ };
+
+ config = mkIf cfg.enable {
+ #TODO: these probably shouldnt go here
+ home.packages = with pkgs; [
+ kdePackages.breeze
+ ];
+
+ home.file.".Xresources".text = ''
+ Xcursor.size: 24
+ Xcursor.theme: breeze_cursors
+ '';
+
+ xsession.windowManager.i3 = {
+ enable = true;
+ config = let
+ #NOTE: Alt (Mod1) and meta (Mod4) have been swapped by keyd.
+ mod = "Mod4";
+
+ ws0 = "0:Main";
+ ws1 = "1:Terminal";
+ ws2 = "2:Browser";
+ ws3 = "3:Chat";
+ ws4 = "4:Gaming";
+ ws5 = "5";
+ ws6 = "6";
+ ws7 = "7";
+ ws8 = "8:Meow";
+ ws9 = "9:Music";
+ ws10 = "10:Misc";
+ ws11 = "11:Empty";
+
+ output = {
+ primary = "primary";
+ left = "DVI-D-0";
+ right = "DisplayPort-1 HDMI-A-0";
+ };
+ in {
+ modifier = "${mod}";
+
+ fonts = {
+ names = [ "monospace" ];
+ size = 8.0;
+ };
+
+ colors = let c = desktop.theme.colors; in {
+ focused = {
+ border = "#${c.fg2}";
+ background = "#${c.fg2}";
+ text = "#${c.bg}";
+ indicator = "#${c.fg2}";
+ childBorder = "#${c.fg2}";
+ };
+
+ focusedInactive = {
+ border = "#${c.bg1}";
+ background = "#${c.bg1}";
+ text = "#${c.fg}";
+ indicator = "#${c.bg1}";
+ childBorder = "#${c.bg1}";
+ };
+
+ unfocused = {
+ border = "#${c.bg}";
+ background = "#${c.bg}";
+ text = "#${c.fg}";
+ indicator = "#${c.bg}";
+ childBorder = "#${c.bg}";
+ };
+ };
+
+ gaps.inner = 8;
+
+ workspaceOutputAssign = [
+ { workspace = "${ws0}"; output = output.primary; }
+ { workspace = "${ws1}"; output = output.primary; }
+
+ { workspace = "${ws2}"; output = output.left; }
+ { workspace = "${ws3}"; output = output.left; }
+
+ { workspace = "${ws4}"; output = output.primary; }
+
+ { workspace = "${ws5}"; output = output.primary; }
+ { workspace = "${ws6}"; output = output.primary; }
+ { workspace = "${ws7}"; output = output.primary; }
+
+ { workspace = "${ws8}"; output = output.primary; }
+ { workspace = "${ws9}"; output = output.right; }
+ { workspace = "${ws10}"; output = output.primary; }
+
+ { workspace = "${ws11}"; output = output.primary; }
+ ];
+
+ assigns = {
+ "${ws2}" = [ { class = "firefox"; } ];
+ "${ws3}" = [ { class = "discord"; } ];
+ "${ws4}" = [
+ { class = "steam"; }
+ { class = "prismlauncher"; }
+ ];
+
+ "${ws8}" = [ { class = "qbittorrent"; } ];
+ "${ws9}" = [ { title = "cmus"; } ];
+ };
+
+ startup = [
+ { command = "polybar-msg cmd quit; polybar"; always = true; notification = false; }
+ { command = "systemctl --user restart picom"; always = true; notification = false; }
+ { command = "${pkgs.feh}/bin/feh --bg-fill ${desktop.background}"; always = true; notification = false; }
+ { command = "${pkgs.fcitx5}/bin/fcitx5 -r -d"; always = true; notification = false; }
+ ];
+
+ keybindings = {
+ "${mod}+Shift+c" = "reload";
+ "${mod}+Shift+r" = "restart";
+ "${mod}+Shift+e" = "exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'\"";
+
+ "${mod}+q" = "kill";
+ "${mod}+d" = "exec \"rofi -modi drun,run -show drun\"";
+ "${mod}+Return" = "exec ${pkgs.kitty}/bin/kitty";
+
+ "${mod}+Num_Lock" = "exec --no-startup-id polybar-msg cmd toggle";
+
+ # Screenshots
+ #TODO: screen and full should be swapped, but currently screen is fucky :'(
+ "Shift+Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot screen -c";
+ "Print" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot full -c";
+ "${mod}+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c";
+ "Mod1+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot gui -c";
+ "${mod}+Ctrl+Shift+s" = "exec --no-startup-id ${pkgs.flameshot}/bin/flameshot launcher -c";
+
+ # Media keys
+ "XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +2%";
+ "XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -2%";
+ "XF86AudioMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
+ "XF86AudioMicMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
+
+ "XF86AudioPlay" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\"";
+ "XF86AudioPause" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any play-pause\"";
+ "XF86AudioStop" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any stop\"";
+ "XF86AudioNext" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any next\"";
+ "XF86AudioPrev" = "exec --no-startup-id \"playerctl --player=cmus,firefox,%any previous\"";
+
+ # Media controller widget
+ "${mod}+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=false";
+ "${mod}+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=true";
+ "${mod}+Shift+m" = "exec --no-startup-id eww-toggle music --arg pos=center --arg gaps=true";
+ "${mod}+Shift+Ctrl+m" = "exec --no-startup-id eww-toggle music --arg pos=right --arg gaps=false";
+
+ # Workspaces
+ "${mod}+grave" = "workspace number ${ws0}";
+ "${mod}+1" = "workspace number ${ws1}";
+ "${mod}+2" = "workspace number ${ws2}";
+ "${mod}+3" = "workspace number ${ws3}";
+ "${mod}+4" = "workspace number ${ws4}";
+ "${mod}+5" = "workspace number ${ws5}";
+ "${mod}+6" = "workspace number ${ws6}";
+ "${mod}+7" = "workspace number ${ws7}";
+ "${mod}+8" = "workspace number ${ws8}";
+ "${mod}+9" = "workspace number ${ws9}";
+ "${mod}+0" = "workspace number ${ws10}";
+ "${mod}+equal" = "workspace number ${ws11}";
+
+ # Move active workspace
+ "${mod}+comma" = "move workspace to output ${output.left}";
+ "${mod}+period" = "move workspace to output ${output.primary}";
+ "${mod}+slash" = "move workspace to output ${output.right}";
+
+ # Layout
+ "${mod}+z" = "layout stacking";
+ "${mod}+x" = "layout tabbed";
+ "${mod}+c" = "layout toggle split";
+
+ # Focus
+ "${mod}+h" = "focus left";
+ "${mod}+j" = "focus down";
+ "${mod}+k" = "focus up";
+ "${mod}+l" = "focus right";
+
+ "${mod}+Left" = "focus left";
+ "${mod}+Down" = "focus down";
+ "${mod}+Up" = "focus up";
+ "${mod}+Right" = "focus right";
+
+ "${mod}+space" = "focus mode_toggle";
+ "${mod}+a" = "focus parent";
+
+ # Move focused container
+ "${mod}+Shift+h" = "move left";
+ "${mod}+Shift+j" = "move down";
+ "${mod}+Shift+k" = "move up";
+ "${mod}+Shift+l" = "move right";
+
+ "${mod}+Shift+Left" = "move left";
+ "${mod}+Shift+Down" = "move down";
+ "${mod}+Shift+Up" = "move up";
+ "${mod}+Shift+Right" = "move right";
+
+ # Misc container binds
+ "${mod}+Shift+space" = "floating toggle";
+ "${mod}+f" = "fullscreen toggle";
+
+ "${mod}+w" = "split h";
+ "${mod}+e" = "split v";
+
+ "${mod}+r" = "mode resize";
+
+ # Move focused container to workspace
+ "${mod}+Shift+grave" = "move container to workspace number ${ws0}";
+ "${mod}+Shift+1" = "move container to workspace number ${ws1}";
+ "${mod}+Shift+2" = "move container to workspace number ${ws2}";
+ "${mod}+Shift+3" = "move container to workspace number ${ws3}";
+ "${mod}+Shift+4" = "move container to workspace number ${ws4}";
+ "${mod}+Shift+5" = "move container to workspace number ${ws5}";
+ "${mod}+Shift+6" = "move container to workspace number ${ws6}";
+ "${mod}+Shift+7" = "move container to workspace number ${ws7}";
+ "${mod}+Shift+8" = "move container to workspace number ${ws8}";
+ "${mod}+Shift+9" = "move container to workspace number ${ws9}";
+ "${mod}+Shift+0" = "move container to workspace number ${ws10}";
+ };
+
+ modes = {
+ resize = {
+ "h" = "resize shrink width 10 px or 10 ppt";
+ "j" = "resize grow height 10 px or 10 ppt";
+ "k" = "resize shrink height 10 px or 10 ppt";
+ "l" = "resize grow width 10 px or 10 ppt";
+
+ "Left" = "resize shrink width 10 px or 10 ppt";
+ "Down" = "resize grow height 10 px or 10 ppt";
+ "Up" = "resize shrink height 10 px or 10 ppt";
+ "Right" = "resize grow width 10 px or 10 ppt";
+
+ "Return" = "mode default";
+ "Escape" = "mode default";
+ "${mod}+r" = "mode default";
+ };
+ };
+
+ bars = [];
+ };
+
+ extraConfig = ''
+ default_border normal 0
+ '';
+ };
+ };
+}
diff --git a/snowfall/modules/home/desktop/components/picom/default.nix b/snowfall/modules/home/desktop/components/picom/default.nix
new file mode 100644
index 0000000..698e06c
--- /dev/null
+++ b/snowfall/modules/home/desktop/components/picom/default.nix
@@ -0,0 +1,30 @@
+{ options, config, lib, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.desktop.components.picom;
+in {
+ options.${namespace}.desktop.components.picom = with types; {
+ enable = mkEnableOption "picom";
+ };
+
+ config = mkIf cfg.enable {
+ services.picom = {
+ enable = true;
+
+ backend = "glx";
+ vSync = true;
+
+ settings = {
+ blur = {
+ method = "gaussian";
+ size = 10;
+ deviation = 2;
+ };
+
+ blur-background-exclude = [
+ "window_type = 'dock'"
+ ];
+ };
+ };
+ };
+}
diff --git a/snowfall/modules/home/desktop/components/polybar/default.nix b/snowfall/modules/home/desktop/components/polybar/default.nix
new file mode 100644
index 0000000..d7ee363
--- /dev/null
+++ b/snowfall/modules/home/desktop/components/polybar/default.nix
@@ -0,0 +1,278 @@
+{ options, config, lib, pkgs, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.desktop.components.polybar;
+ desktop = config.${namespace}.desktop;
+in {
+ options.${namespace}.desktop.components.polybar = with types; {
+ enable = mkEnableOption "polybar";
+ };
+
+ config = mkIf cfg.enable {
+ services.polybar = {
+ enable = true;
+ script = "";
+
+ package = pkgs.polybar.override {
+ i3Support = true;
+ pulseSupport = true;
+ };
+
+ settings = let c = desktop.theme.colors; in {
+ "bar/main" = {
+ width = "100%";
+ height = "24pt";
+ radius = 0;
+
+ background = "#${c.bg}";
+ foreground = "#${c.fg}";
+
+ font = [
+ "Symbols Nerd Font:size=16;2"
+ "monospace:size=11;2"
+ "Sauce Code Pro Nerd Font:size=11;2"
+ "Noto Sans CJK JP:size=11;1"
+ "sans-serif:size=11;1"
+ ];
+
+ border = {
+ top = "8px";
+ left = "8px";
+ right = "8px";
+
+ color = "#00000000";
+ };
+
+ padding = {
+ left = 2;
+ right = 2;
+ };
+
+ cursor = {
+ click = "pointer";
+ scroll = "ns-resize";
+ };
+
+ enable-ipc = true;
+
+ line.size = "3pt";
+
+ separator = {
+ text = "|";
+ foreground = "#${c.bg3}";
+ };
+
+ module.margin = 1;
+ modules = {
+ left = "stat music";
+ center = "i3";
+ right = "wlan eth filesystem keyboard xkeyboard pulseaudio date";
+ };
+ };
+
+ "module/keyboard" = {
+ type = "custom/script";
+
+ exec = "if [[ $(fcitx5-remote -n) == 'mozc' ]]; then printf 'jp'; else printf 'en'; fi";
+ interval = 1;
+
+ click.left = "${pkgs.fcitx5}/bin/fcitx5-remote -t";
+
+ format = {
+ prefix = {
+ text = "󰌌 ";
+ foreground = "#${c.accent}";
+ };
+ };
+ };
+
+ "module/music" = {
+ type = "custom/script";
+
+ exec = "playerctl --player=cmus,firefox,%any -F metadata --format='{{title}} - {{artist}}'";
+ tail = true;
+
+ format = {
+ prefix = {
+ text = "󰎄 ";
+ foreground = "#${c.accent}";
+ };
+ };
+ };
+
+ "module/stat" = {
+ type = "custom/script";
+
+ exec = "vmstat -n 2 | awk '{printf \"%.0f%% %.2f GiB\\\\n\", 100-$15, (31998756-($4+$5+$6))/1024/1024};fflush()'";
+ tail = true;
+
+ format = {
+ prefix = {
+ text = "󱕍 ";
+ foreground = "#${c.accent}";
+ };
+ };
+ };
+
+ "module/i3" = {
+ type = "internal/i3";
+
+ strip-wsnumbers = true;
+ index-sort = true;
+
+ ws.icon = [
+ "0:Main;󱄅" "1:Terminal;" "2:Browser;󰈹" "3:Chat;󰙯" "4:Gaming;󰓓"
+ "5;󰎱" "6;󰎳" "7;󰎶"
+ "8:Meow;󰄛" "9:Music;󰲸" "10:Misc;󰁴"
+ ];
+
+ label = {
+ focused = {
+ text = "%icon%";
+ padding = 2;
+
+ foreground = "#${c.fg0}";
+ background = "#${c.bg1}";
+ underline = "#${c.accent}";
+ };
+
+ visible = {
+ text = "%icon%";
+ padding = 2;
+
+ underline = "#${c.fg4}";
+ };
+
+ unfocused = {
+ text = "%icon%";
+ padding = 2;
+ };
+
+ urgent = {
+ text = "%icon%";
+ padding = 2;
+
+ foreground = "#${c.bg}";
+ background = "#${c.accent}";
+ };
+ };
+ };
+
+ "module/xwindow" = {
+ type = "internal/xwindow";
+ label = "%title:0:64:...%";
+ };
+
+
+ "module/pulseaudio" = {
+ type = "internal/pulseaudio";
+
+ format.volume = "<ramp-volume> <label-volume>";
+
+ label = {
+ volume = "%percentage%%";
+ muted = {
+ text = "󰝟 %percentage%%";
+ foreground = "#${c.bg3}";
+ };
+ };
+
+ ramp.volume = {
+ text = [ "󰕿" "󰖀" "󰕾" ];
+ foreground = "#${c.accent}";
+ };
+ };
+
+ "module/xkeyboard" = {
+ type = "internal/xkeyboard";
+ blacklist = [ "num lock" ];
+
+ indicator.icon = [ "caps lock;;󰌎" ];
+
+ format = {
+ text = "<label-indicator>";
+ };
+
+ label = {
+ indicator.on = "%icon%";
+ };
+ };
+
+ "module/cpu" = {
+ type = "internal/cpu";
+ interval = 2;
+
+ format.prefix = {
+ text = "CPU ";
+ foreground = "#${c.accent}";
+ };
+
+ label = "%percentage%%";
+ };
+
+ "module/memory" = {
+ type = "internal/memory";
+ interval = 2;
+
+ format.prefix = {
+ text = "MEM ";
+ foreground = "#${c.accent}";
+ };
+
+ label = "%gb_used%";
+ };
+
+ "module/filesystem" = {
+ type = "internal/fs";
+ interval = 25;
+
+ mount = [ "/nix" "/persist" ];
+
+ label = {
+ mounted = "%{F#${c.accent}}󰋊%{F-} %used%";
+ unmounted = {
+ text = "%mountpoint%";
+ foreground = "#${c.bg3}";
+ };
+ };
+ };
+
+ "module/eth" = {
+ type = "internal/network";
+ interface.type = "wired";
+ interval = 2;
+
+ format.connected = "<label-connected>";
+ label.connected = "%{F#${c.accent}}󰈀%{F-} 󰄼 %downspeed% 󰄿 %upspeed%";
+ };
+
+ "module/wlan" = {
+ type = "internal/network";
+ interface.type = "wireless";
+ interval = 2;
+
+ format.connected = "<ramp-signal> <label-connected>";
+ label.connected = "󰄼 %downspeed% 󰄿 %upspeed%";
+
+ ramp-signal = {
+ text = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ];
+ foreground = "#${c.accent}";
+ };
+ };
+
+ "module/date" = {
+ type = "internal/date";
+ interval = 1;
+
+ date = "%H:%M";
+ date-alt = "%Y-%m-%d %H:%M:%S";
+
+ format.prefix = {
+ text = "󰃰 ";
+ foreground = "#${c.accent}";
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/snowfall/modules/home/desktop/components/rofi/default.nix b/snowfall/modules/home/desktop/components/rofi/default.nix
new file mode 100644
index 0000000..a1dbe33
--- /dev/null
+++ b/snowfall/modules/home/desktop/components/rofi/default.nix
@@ -0,0 +1,58 @@
+{ options, config, lib, namespace, ... }:
+
+with lib; with lib.${namespace}; let
+ cfg = config.${namespace}.desktop.components.rofi;
+ desktop = config.${namespace}.desktop;
+in {
+ options.${namespace}.desktop.components.rofi = with types; {
+ enable = mkEnableOption "rofi";
+ };
+
+ config = mkIf cfg.enable {
+ programs.rofi = {
+ enable = true;
+
+ font = "monospace 12";
+
+ theme = let
+ inherit (config.lib.formats.rasi) mkLiteral;
+ c = desktop.theme.colors;
+ in {
+ "@import" = "default";
+
+ "*" = {
+ background = mkLiteral "#${c.bg}";
+ foreground = mkLiteral "#${c.fg}";
+ foreground-alt = mkLiteral "#${c.bg3}";
+
+ alternate-normal-background = mkLiteral "var(background)";
+
+ selected-normal-foreground = mkLiteral "var(background)";
+ selected-normal-background = mkLiteral "#${c.accent}";
+
+ border-color = mkLiteral "var(background)";
+ separatorcolor = mkLiteral "#${c.bg3}";
+ };
+
+ inputbar = {
+ children = map mkLiteral [ "entry" "num-filtered-rows" "textbox-num-sep" "num-rows" ];
+ };
+
+ element = {
+ children = map mkLiteral [ "element-icon" "element-text" ];
+ };
+
+ entry.placeholder = "";
+
+ scrollbar.handle-color = mkLiteral "var(foreground-alt)";
+ num-rows.text-color = mkLiteral "var(foreground-alt)";
+ num-filtered-rows.text-color = mkLiteral "var(foreground-alt)";
+ textbox-num-sep.text-color = mkLiteral "var(foreground-alt)";
+
+ message.border = mkLiteral "1px solid 0px 0px";
+ listview.border = mkLiteral "1px solid 0px 0px";
+ sidebar.border = mkLiteral "1px solid 0px 0px";
+ };
+ };
+ };
+}
diff --git a/snowfall/modules/home/desktop/default.nix b/snowfall/modules/home/desktop/default.nix
index 5f8c905..e89ec86 100644
--- a/snowfall/modules/home/desktop/default.nix
+++ b/snowfall/modules/home/desktop/default.nix
@@ -14,6 +14,7 @@ in {
"shinobu.png"
"skull.png"
];
+ apply = value: ./bg/${value};
};
theme = {