diff --git a/users/guanranwang/home-manager/nixos/default.nix b/users/guanranwang/home-manager/nixos/default.nix
index 2151b67..77d7cc9 100644
--- a/users/guanranwang/home-manager/nixos/default.nix
+++ b/users/guanranwang/home-manager/nixos/default.nix
@@ -7,6 +7,8 @@
./dotfiles.nix
./i18n.nix
+ ./sway.nix
+ ./waybar.nix
./xdg
];
diff --git a/users/guanranwang/home-manager/nixos/home.nix b/users/guanranwang/home-manager/nixos/home.nix
index 5be7038..8b950d6 100644
--- a/users/guanranwang/home-manager/nixos/home.nix
+++ b/users/guanranwang/home-manager/nixos/home.nix
@@ -259,130 +259,6 @@
source = ~/.config/hypr/env.conf
'';
};
- sway = {
- enable = true;
- extraOptions = [ "--unsupported-gpu" "-D" "noscanout" ];
- wrapperFeatures.gtk = true;
- systemd = {
- enable = true;
- xdgAutostart = true;
- };
- config = {
- ### Default Applications
- terminal = "${pkgs.alacritty}/bin/alacritty";
- menu = "${pkgs.rofi}/bin/rofi";
-
- ### Visuals
- bars = [];
- gaps = {
- inner = 4;
- outer = 4;
- #smartGaps = true;
- };
-
- ### Inputs
- input = {
- "*" = {
- accel_profile = "flat";
- natural_scroll = "enabled";
-
- # touchpad
- tap = "enabled";
- drag = "enabled";
- dwt = "disabled";
- };
- };
-
- ### Autostarts
- startup = [
- { command = "${pkgs.swww}/bin/swww init"; }
- { command = "${pkgs.waybar}/bin/waybar"; }
- { command = "${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store"; }
- { command = "${pkgs.udiskie}/bin/udiskie --smart-tray"; }
- ];
-
- ### Keybinds
- defaultWorkspace = "workspace number 1";
- modifier = "Mod4";
- modes = {};
- keybindings =
- let
- modifier = config.wayland.windowManager.sway.config.modifier;
- setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl";
- setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer";
- screenshot = "/home/guanranwang/.local/bin/wrapped-grim";
- in
- {
- ### Sway itself
- # Window
- "${modifier}+s" = "split toggle";
- "${modifier}+v" = "floating toggle";
- "${modifier}+f" = "fullscreen";
- "${modifier}+q" = "kill";
- "${modifier}+Shift+e" = "exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' '${pkgs.sway}/bin/swaymsg exit'";
-
- # Move around
- "${modifier}+h" = "focus left";
- "${modifier}+j" = "focus down";
- "${modifier}+k" = "focus up";
- "${modifier}+l" = "focus right";
-
- # Workspaces
- # Switch to workspace
- "${modifier}+1" = "workspace 1";
- "${modifier}+2" = "workspace 2";
- "${modifier}+3" = "workspace 3";
- "${modifier}+4" = "workspace 4";
- "${modifier}+5" = "workspace 5";
- "${modifier}+6" = "workspace 6";
- "${modifier}+7" = "workspace 7";
- "${modifier}+8" = "workspace 8";
- "${modifier}+9" = "workspace 9";
- "${modifier}+0" = "workspace 10";
- # Move focused Window to workspace
- "${modifier}+Shift+1" = "move container to workspace 1";
- "${modifier}+Shift+2" = "move container to workspace 2";
- "${modifier}+Shift+3" = "move container to workspace 3";
- "${modifier}+Shift+4" = "move container to workspace 4";
- "${modifier}+Shift+5" = "move container to workspace 5";
- "${modifier}+Shift+6" = "move container to workspace 6";
- "${modifier}+Shift+7" = "move container to workspace 7";
- "${modifier}+Shift+8" = "move container to workspace 8";
- "${modifier}+Shift+9" = "move container to workspace 9";
- "${modifier}+Shift+0" = "move container to workspace 10";
-
- ### Execute other stuff
- # Launch applications
- "${modifier}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}";
- "${modifier}+w" = "exec ${pkgs.xdg-utils}/bin/xdg-open http:";
- "${modifier}+e" = "exec ${pkgs.xdg-utils}/bin/xdg-open ~";
-
- # Rofi
- "${modifier}+d" = "exec ${config.wayland.windowManager.sway.config.menu} -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}";
- "${modifier}+Shift+d" = "exec ${pkgs.cliphist}/bin/cliphist list | ${config.wayland.windowManager.sway.config.menu} -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy";
- "${modifier}+Shift+l" = "exec ${config.wayland.windowManager.sway.config.menu} -modi \"power-menu:rofi-power-menu --confirm=reboot/shutdown\" -show power-menu";
-
- # Screenshot
- "${modifier}+Shift+s" = "exec ${screenshot} region";
- "${modifier}+Control+Shift+s" = "exec ${screenshot} region edit";
- "Print" = "exec ${screenshot} fullscreen";
- "Print+Control" = "exec ${screenshot} fullscreen edit";
-
- # Fn keys
- "XF86MonBrightnessUp" = "exec ${setBrightness} up";
- "XF86MonBrightnessDown" = "exec ${setBrightness} down";
- "XF86AudioRaiseVolume" = "exec ${setVolume} up";
- "XF86AudioLowerVolume" = "exec ${setVolume} down";
- "XF86AudioMute" = "exec ${setVolume} mute";
- "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
- "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
- "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
- "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
- "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
- "XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
- };
- };
- };
};
#xsession = {
@@ -400,160 +276,6 @@
end
end
'';
- waybar = {
- enable = true;
- settings = {
- mainBar = {
- "layer" = "top";
- "modules-left" = [ "custom/launcher" "sway/workspaces" "gamemode" ];
- "modules-center" = [ "sway/window" ];
- "modules-right" = [ "tray" "pulseaudio" "battery" "clock" ];
- "custom/launcher" = { "format" = ""; };
- "gamemode" = {
- "format" = "{glyph} {count}";
- "glyph" = "";
- "hide-not-running" = true;
- "use-icon" = true;
- "icon-name" = "input-gaming-symbolic";
- "icon-spacing" = 4;
- "icon-size" = 20;
- "tooltip" = true;
- "tooltip-format" = "Games running = {count}";
- };
- "sway/workspaces" = {
- "format" = "{icon}";
- "format-icons" = {
- "1" = "";
- "2" = "";
- "3" = "";
- "4" = "";
- "5" = "";
- "urgent" = "";
- "active" = "";
- "default" = "";
- };
- };
- "sway/window" = {
- "format" = "{}";
- "separate-outputs" = true;
- };
- "tray" = {
- "spacing" = 10;
- };
- "pulseaudio" = {
- "format" = "{volume}% {icon}";
- "format-bluetooth" = "{volume}% {icon}";
- "format-muted" = "";
- "format-icons" = {
- "headphone" = "";
- "hands-free" = "";
- "headset" = "";
- "phone" = "";
- "portable" = "";
- "car" = "";
- "default" = [ "" "" ];
- };
- "scroll-step" = 5;
- "on-click" = "pavucontrol";
- "ignored-sinks" = ["Easy Effects Sink"];
- };
- "battery" = {
- "bat" = "BAT0";
- "interval" = 60;
- "states" = {
- "warning" = 30;
- "critical" = 15;
- };
- "format" = "{capacity}% {icon}";
- "format-icons" = [ "" "" "" "" "" ];
- "max-length" = 25;
- };
- "clock" = {
- "format" = "{:%A %H:%M} ";
- "tooltip-format" = "{calendar}";
- };
- };
- };
- style = ''
- * {
- font: bold 14px "JetBrainsMono Nerd Font Propo";
- }
- window#waybar {
- background: transparent;
- }
- tooltip {
- background: #1a1b26;
- color: #c0caf5;
- border: 2px solid #c0caf5;
- border-radius: 5px;
- }
- #custom-launcher,
- #gamemode,
- #window,
- #workspaces,
- #tray,
- #pulseaudio,
- #battery,
- #clock,
- #cava {
- text-shadow: 1px 1px 2px black;
- background: #1a1b26;
- color: #c0caf5; /* text color */
- margin: 10px 4px 4px 4px;
- padding: 4px 10px;
- box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.4);
- border-radius: 5px; /* rounded corners */
- }
- #custom-launcher {
- margin-left: 10px;
- }
- #clock {
- margin-right: 10px;
- }
- #workspaces {
- padding: 0px;
- }
- #workspaces button {
- text-shadow: 1px 1px 2px black;
- color: #c0caf5;
- padding: 0px 4px;
- border: 2px solid #1a1b26;
- transition-property: background, color, text-shadow, min-width;
- transition-duration: .15s;
- }
- #workspaces button.focused {
- text-shadow: none;
- color: #c0caf5;
- background: linear-gradient(
- 70deg,
- rgb(192, 202, 245),
- rgb(192, 202, 245),
- rgb(192, 202, 245),
- rgb(192, 202, 245),
- rgb(229, 234, 255),
- rgb(192, 202, 245),
- rgb(192, 202, 245),
- rgb(192, 202, 245),
- rgb(192, 202, 245)
- );
- background-size: 300% 100%;
- background-position: 0% 0%;
- animation: colored-gradient 2s linear infinite;
- color: #1a1b26; /* icon(text) color */
- min-width: 36px;
- }
- #workspaces button.focused:hover {
- background: #9fa7cc; /* hovered workspace color */
- }
- #workspaces button:hover {
- background: #11111b; /* hovered workspace color */
- }
- @keyframes colored-gradient {
- from {background-position: 0% 0%;}
- to {background-position: 100% 0%;}
- }
- '';
- };
rofi = {
#enable = true;
package = pkgs.rofi-wayland;
diff --git a/users/guanranwang/home-manager/nixos/sway.nix b/users/guanranwang/home-manager/nixos/sway.nix
new file mode 100644
index 0000000..9a8c45e
--- /dev/null
+++ b/users/guanranwang/home-manager/nixos/sway.nix
@@ -0,0 +1,128 @@
+{ config, pkgs, ... }:
+
+{
+ wayland.windowManager.sway = {
+ enable = true;
+ extraOptions = [ "--unsupported-gpu" "-D" "noscanout" ];
+ wrapperFeatures.gtk = true;
+ systemd = {
+ enable = true;
+ xdgAutostart = true;
+ };
+ config = {
+ ### Default Applications
+ terminal = "${pkgs.alacritty}/bin/alacritty";
+ menu = "${pkgs.rofi}/bin/rofi";
+
+ ### Visuals
+ bars = [];
+ gaps = {
+ inner = 4;
+ outer = 4;
+ #smartGaps = true;
+ };
+
+ ### Inputs
+ input = {
+ "*" = {
+ accel_profile = "flat";
+ natural_scroll = "enabled";
+
+ # touchpad
+ tap = "enabled";
+ drag = "enabled";
+ dwt = "disabled";
+ };
+ };
+
+ ### Autostarts
+ startup = [
+ { command = "${pkgs.swww}/bin/swww init"; }
+ { command = "${pkgs.waybar}/bin/waybar"; }
+ { command = "${pkgs.wl-clipboard}/bin/wl-paste --watch cliphist store"; }
+ { command = "${pkgs.udiskie}/bin/udiskie --smart-tray"; }
+ ];
+
+ ### Keybinds
+ defaultWorkspace = "workspace number 1";
+ modifier = "Mod4";
+ modes = {};
+ keybindings =
+ let
+ modifier = config.wayland.windowManager.sway.config.modifier;
+ setBrightness = "/home/guanranwang/.local/bin/wrapped-brightnessctl";
+ setVolume = "/home/guanranwang/.local/bin/wrapped-pamixer";
+ screenshot = "/home/guanranwang/.local/bin/wrapped-grim";
+ in
+ {
+ ### Sway itself
+ # Window
+ "${modifier}+s" = "split toggle";
+ "${modifier}+v" = "floating toggle";
+ "${modifier}+f" = "fullscreen";
+ "${modifier}+q" = "kill";
+ "${modifier}+Shift+e" = "exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' '${pkgs.sway}/bin/swaymsg exit'";
+
+ # Move around
+ "${modifier}+h" = "focus left";
+ "${modifier}+j" = "focus down";
+ "${modifier}+k" = "focus up";
+ "${modifier}+l" = "focus right";
+
+ # Workspaces
+ # Switch to workspace
+ "${modifier}+1" = "workspace 1";
+ "${modifier}+2" = "workspace 2";
+ "${modifier}+3" = "workspace 3";
+ "${modifier}+4" = "workspace 4";
+ "${modifier}+5" = "workspace 5";
+ "${modifier}+6" = "workspace 6";
+ "${modifier}+7" = "workspace 7";
+ "${modifier}+8" = "workspace 8";
+ "${modifier}+9" = "workspace 9";
+ "${modifier}+0" = "workspace 10";
+ # Move focused Window to workspace
+ "${modifier}+Shift+1" = "move container to workspace 1";
+ "${modifier}+Shift+2" = "move container to workspace 2";
+ "${modifier}+Shift+3" = "move container to workspace 3";
+ "${modifier}+Shift+4" = "move container to workspace 4";
+ "${modifier}+Shift+5" = "move container to workspace 5";
+ "${modifier}+Shift+6" = "move container to workspace 6";
+ "${modifier}+Shift+7" = "move container to workspace 7";
+ "${modifier}+Shift+8" = "move container to workspace 8";
+ "${modifier}+Shift+9" = "move container to workspace 9";
+ "${modifier}+Shift+0" = "move container to workspace 10";
+
+ ### Execute other stuff
+ # Launch applications
+ "${modifier}+Return" = "exec ${config.wayland.windowManager.sway.config. terminal}";
+ "${modifier}+w" = "exec ${pkgs.xdg-utils}/bin/xdg-open http:";
+ "${modifier}+e" = "exec ${pkgs.xdg-utils}/bin/xdg-open ~";
+
+ # Rofi
+ "${modifier}+d" = "exec ${config.wayland.windowManager.sway.config. menu} -show drun -show-icons -icon-theme ${config.gtk.iconTheme.name}";
+ "${modifier}+Shift+d" = "exec ${pkgs.cliphist}/bin/cliphist list | ${config. wayland.windowManager.sway.config.menu} -dmenu | ${pkgs.cliphist}/bin/cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy";
+ "${modifier}+Shift+l" = "exec ${config.wayland.windowManager.sway.config. menu} -modi \"power-menu:rofi-power-menu --confirm=reboot/shutdown\" -show power-menu";
+
+ # Screenshot
+ "${modifier}+Shift+s" = "exec ${screenshot} region";
+ "${modifier}+Control+Shift+s" = "exec ${screenshot} region edit";
+ "Print" = "exec ${screenshot} fullscreen";
+ "Print+Control" = "exec ${screenshot} fullscreen edit";
+
+ # Fn keys
+ "XF86MonBrightnessUp" = "exec ${setBrightness} up";
+ "XF86MonBrightnessDown" = "exec ${setBrightness} down";
+ "XF86AudioRaiseVolume" = "exec ${setVolume} up";
+ "XF86AudioLowerVolume" = "exec ${setVolume} down";
+ "XF86AudioMute" = "exec ${setVolume} mute";
+ "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
+ "XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
+ "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
+ "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
+ "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
+ "XF86AudioMedia" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
+ };
+ };
+ };
+}
\ No newline at end of file
diff --git a/users/guanranwang/home-manager/nixos/waybar.nix b/users/guanranwang/home-manager/nixos/waybar.nix
new file mode 100644
index 0000000..e51ef17
--- /dev/null
+++ b/users/guanranwang/home-manager/nixos/waybar.nix
@@ -0,0 +1,156 @@
+{
+ programs.waybar = {
+ enable = true;
+ settings = {
+ mainBar = {
+ "layer" = "top";
+ "modules-left" = [ "custom/launcher" "sway/workspaces" "gamemode" ];
+ "modules-center" = [ "sway/window" ];
+ "modules-right" = [ "tray" "pulseaudio" "battery" "clock" ];
+ "custom/launcher" = { "format" = ""; };
+ "gamemode" = {
+ "format" = "{glyph} {count}";
+ "glyph" = "";
+ "hide-not-running" = true;
+ "use-icon" = true;
+ "icon-name" = "input-gaming-symbolic";
+ "icon-spacing" = 4;
+ "icon-size" = 20;
+ "tooltip" = true;
+ "tooltip-format" = "Games running = {count}";
+ };
+ "sway/workspaces" = {
+ "format" = "{icon}";
+ "format-icons" = {
+ "1" = "";
+ "2" = "";
+ "3" = "";
+ "4" = "";
+ "5" = "";
+ "urgent" = "";
+ "active" = "";
+ "default" = "";
+ };
+ };
+ "sway/window" = {
+ "format" = "{}";
+ "separate-outputs" = true;
+ };
+ "tray" = {
+ "spacing" = 10;
+ };
+ "pulseaudio" = {
+ "format" = "{volume}% {icon}";
+ "format-bluetooth" = "{volume}% {icon}";
+ "format-muted" = "";
+ "format-icons" = {
+ "headphone" = "";
+ "hands-free" = "";
+ "headset" = "";
+ "phone" = "";
+ "portable" = "";
+ "car" = "";
+ "default" = [ "" "" ];
+ };
+ "scroll-step" = 5;
+ "on-click" = "pavucontrol";
+ "ignored-sinks" = ["Easy Effects Sink"];
+ };
+ "battery" = {
+ "bat" = "BAT0";
+ "interval" = 60;
+ "states" = {
+ "warning" = 30;
+ "critical" = 15;
+ };
+ "format" = "{capacity}% {icon}";
+ "format-icons" = [ "" "" "" "" "" ];
+ "max-length" = 25;
+ };
+ "clock" = {
+ "format" = "{:%A %H:%M} ";
+ "tooltip-format" = "{calendar}";
+ };
+ };
+ };
+ style = ''
+ * {
+ font: bold 14px "JetBrainsMono Nerd Font Propo";
+ }
+ window#waybar {
+ background: transparent;
+ }
+ tooltip {
+ background: #1a1b26;
+ color: #c0caf5;
+ border: 2px solid #c0caf5;
+ border-radius: 5px;
+ }
+ #custom-launcher,
+ #gamemode,
+ #window,
+ #workspaces,
+ #tray,
+ #pulseaudio,
+ #battery,
+ #clock,
+ #cava {
+ text-shadow: 1px 1px 2px black;
+ background: #1a1b26;
+ color: #c0caf5; /* text color */
+ margin: 10px 4px 4px 4px;
+ padding: 4px 10px;
+ box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.4);
+ border-radius: 5px; /* rounded corners */
+ }
+ #custom-launcher {
+ margin-left: 10px;
+ }
+ #clock {
+ margin-right: 10px;
+ }
+ #workspaces {
+ padding: 0px;
+ }
+ #workspaces button {
+ text-shadow: 1px 1px 2px black;
+ color: #c0caf5;
+ padding: 0px 4px;
+ border: 2px solid #1a1b26;
+ transition-property: background, color, text-shadow, min-width;
+ transition-duration: .15s;
+ }
+ #workspaces button.focused {
+ text-shadow: none;
+ color: #c0caf5;
+ background: linear-gradient(
+ 70deg,
+ rgb(192, 202, 245),
+ rgb(192, 202, 245),
+ rgb(192, 202, 245),
+ rgb(192, 202, 245),
+ rgb(229, 234, 255),
+ rgb(192, 202, 245),
+ rgb(192, 202, 245),
+ rgb(192, 202, 245),
+ rgb(192, 202, 245)
+ );
+ background-size: 300% 100%;
+ background-position: 0% 0%;
+ animation: colored-gradient 2s linear infinite;
+ color: #1a1b26; /* icon(text) color */
+ min-width: 36px;
+ }
+ #workspaces button.focused:hover {
+ background: #9fa7cc; /* hovered workspace color */
+ }
+ #workspaces button:hover {
+ background: #11111b; /* hovered workspace color */
+ }
+ @keyframes colored-gradient {
+ from {background-position: 0% 0%;}
+ to {background-position: 100% 0%;}
+ }
+ '';
+ };
+}
\ No newline at end of file