Change most things over to use sway

Added most config, at least enough to get by for now

Update waybar config to remove hyprland-specific things

Misc updates to rofi, swaylock

Set greetd to start sway on machines by default now
This commit is contained in:
Evie Litherland-Smith 2024-04-12 17:56:13 +01:00
parent 2ce32bad4c
commit a4ab3c7288
9 changed files with 192 additions and 127 deletions

View file

@ -170,7 +170,16 @@
++ systemModules; ++ systemModules;
}; };
in { in {
nixosConfigurations = { nixosConfigurations = let
swaygreet = {
services.greetd.settings = let
command = "sway";
in {
default_session = {inherit command;};
initial_session = {inherit command;};
};
};
in {
## Server ## Server
Legion = systemConfig { Legion = systemConfig {
@ -191,24 +200,14 @@
Northstar = systemConfig { Northstar = systemConfig {
hostName = "Northstar"; hostName = "Northstar";
systemModules = [ systemModules = [./system/laptop.nix swaygreet];
./system/laptop.nix homeModules = [./home/sway/swayfx.nix];
./system/hyprland.nix
];
homeModules = [
./home/hyprland/default.nix
];
}; };
Vanguard = systemConfig { Vanguard = systemConfig {
hostName = "Vanguard"; hostName = "Vanguard";
systemModules = [ systemModules = [./system/desktop ./system/games.nix swaygreet];
./system/hyprland.nix homeModules = [./home/sway/swayfx.nix];
./system/games.nix
];
homeModules = [
./home/hyprland/default.nix
];
}; };
## Work ## Work
@ -216,26 +215,15 @@
Ronin = systemConfig { Ronin = systemConfig {
hostName = "Ronin"; hostName = "Ronin";
user = "elitherl"; user = "elitherl";
systemModules = [ systemModules = [./system/laptop.nix swaygreet];
./system/laptop.nix homeModules = [./home/sway/swayfx.nix ./home/email/work.nix];
./system/hyprland.nix
];
homeModules = [
./home/hyprland/default.nix
./home/email/work.nix
];
}; };
Scorch = systemConfig { Scorch = systemConfig {
hostName = "Scorch"; hostName = "Scorch";
user = "elitherl"; user = "elitherl";
systemModules = [ systemModules = [./system/desktop.nix swaygreet];
./system/hyprland.nix homeModules = [./home/sway/swayfx.nix ./home/email/work.nix];
];
homeModules = [
./home/hyprland/default.nix
./home/email/work.nix
];
}; };
}; };
}; };

View file

@ -14,7 +14,7 @@
plugins = with pkgs; [rofi-emoji]; plugins = with pkgs; [rofi-emoji];
pass = { pass = {
enable = true; enable = true;
package = pkgs.rofi-wayland; # package = pkgs.rofi-wayland;
extraConfig = '' extraConfig = ''
USERNAME_field='login' USERNAME_field='login'
''; '';

View file

@ -5,12 +5,12 @@
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
### Variables ### Variables
set $mod Mod1 set $mod Mod4
set $left h set $left h
set $down j set $down j
set $up k set $up k
set $right l set $right l
set $term foot set $term alacritty
# Your preferred application launcher # Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened # Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on. # on the original workspace that the command was run on.
@ -19,24 +19,17 @@ set $menu rofi -show drun
include /etc/sway/config-vars.d/* include /etc/sway/config-vars.d/*
### Output configuration ### Output configuration
output DSI-1 scale 2.0 transform 270 output DP-1 scale 1.5
input type:touch map_to_output DSI-1
input type:touchpad click_method clickfinger
# this is for Lenovo's USI pen
input 10182:3632:hid-over-i2c_27C6:0E30 map_to_output DSI-1
bindsym $mod+F6 exec brightnessctl s 5%-
bindsym $mod+F7 exec brightnessctl s 5%+
gaps inner 5 gaps inner 5
gaps outer 20 gaps outer 10
default_border pixel 2 default_border pixel 2
### Input configuration ### Input configuration
input * { input * {
xkb_layout gb xkb_layout gb
xkb_options ctrl:nocaps
} }
# #
@ -52,41 +45,39 @@ set $ws7 "7"
set $ws8 "8" set $ws8 "8"
set $ws9 "9" set $ws9 "9"
workspace $ws1 output DSI-1 # workspace $ws1 output DSI-1
workspace $ws2 output DSI-1 # workspace $ws2 output DSI-1
workspace $ws3 output DSI-1 # workspace $ws3 output DSI-1
workspace $ws4 output DSI-1 # workspace $ws4 output DSI-1
workspace $ws5 output DSI-1 # workspace $ws5 output DSI-1
workspace $ws6 output DSI-1 # workspace $ws6 output DSI-1
workspace $ws7 output DSI-1 # workspace $ws7 output DSI-1
workspace $ws8 output DSI-1 # workspace $ws8 output DSI-1
assign [app_id="foot"] $ws1 # assign [app_id="foot"] $ws1
assign [class="(?i)firefox"] $ws2 # assign [class="(?i)firefox"] $ws2
assign [app_id="(?i)firefox"] $ws2 # assign [app_id="(?i)firefox"] $ws2
assign [class="(?i)chromium"] $ws2 # assign [class="(?i)chromium"] $ws2
assign [app_id="(?i)chromium"] $ws2 # assign [app_id="(?i)chromium"] $ws2
assign [class="org.kde.dolphin"] $ws3 # assign [class="org.kde.dolphin"] $ws3
assign [class="thunderbird"] $ws4 # assign [class="thunderbird"] $ws4
assign [class="Mailspring"] $ws4 # assign [class="Mailspring"] $ws4
assign [class="Element"] $ws5 # assign [class="Element"] $ws5
assign [class="Signal"] $ws5 # assign [class="Signal"] $ws5
assign [class="Steam"] $ws6 # assign [class="Steam"] $ws6
assign [class="Bitwarden"] $ws7 # assign [class="Bitwarden"] $ws7
assign [class="Nxplayer.bin"] $ws8 # assign [class="Nxplayer.bin"] $ws8
for_window [app_id="pavucontrol"] floating enable for_window [app_id="pavucontrol"] floating enable
### Key bindings ### Key bindings
bindsym $mod+F1 exec swaylock
bindsym $mod+Return exec $term bindsym $mod+Return exec $term
bindsym $mod+q kill bindsym $mod+q kill
bindsym $mod+space exec $menu bindsym $mod+space exec $menu
bindsym $mod+e exec power-profiles bindsym $mod+e exec emacsclient -c
bindsym $mod+p exec wlogout bindsym $mod+w exec firefox
bindsym $mod+F1 exec swaylock bindsym $mod+f exec thunar
bindsym $mod+w exec chromium
bindsym $mod+f exec $term -e ranger
bindsym $mod+Shift+f exec dolphin
floating_modifier $mod normal floating_modifier $mod normal
@ -94,7 +85,7 @@ floating_modifier $mod normal
bindsym $mod+Shift+r reload bindsym $mod+Shift+r reload
# Exit sway (logs you out of your Wayland session) # Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec 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' 'swaymsg exit' bindsym $mod+Shift+q exec 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' 'swaymsg exit'
# Move your focus around # Move your focus around
bindsym $mod+$left focus left bindsym $mod+$left focus left
@ -185,11 +176,19 @@ bindsym $mod+r mode "resize"
# #
# Read `man 5 sway-bar` for more information about this section. # Read `man 5 sway-bar` for more information about this section.
include /etc/sway/config.d/* # SwayFX additional settings
corner_radius 10
blur enable
blur_xray disable
blur_passes 3
blur_radius 5
corner_radius 10
shadows enable
shadow_blur_radius 4
titlebar_separator enable
scratchpad_minimize disable
exec dunst
# exec hyprpaper
exec waybar exec waybar
# exec eww daemon
# vim: ft=i3config # vim: ft=i3config

View file

@ -10,7 +10,6 @@
imports = [../desktop.nix]; imports = [../desktop.nix];
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
package = null;
swaynag.enable = true; swaynag.enable = true;
systemd.enable = true; systemd.enable = true;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
@ -24,23 +23,45 @@
}; };
modifier = "Mod4"; modifier = "Mod4";
terminal = "${config.programs.alacritty.package}/bin/alacritty"; terminal = "${config.programs.alacritty.package}/bin/alacritty";
output = { menu = "${config.programs.rofi.finalPackage}/bin/rofi -show drun";
# DSI-1 = { workspaceAutoBackAndForth = true;
# scale = "2.0"; bars = [];
# transform = "270";
# bg = "~/nixos/wallpaper.jpg fill";
# };
};
gaps = { gaps = {
inner = 5; inner = 5;
top = 10; outer = 10;
bottom = 10; };
left = 10; fonts = {
right = 10; names = [fonts.monospace.name fonts.emoji.name];
style = "regular";
size = 12.0; # fonts.sizes.desktop;
};
colors = with scheme.withHashtag; let
text = toString base05;
indicator = toString cyan;
in rec {
background = toString base00;
focused = rec {
inherit background text indicator;
border = toString scheme.withHashtag.${accentColour};
childBorder = border;
};
focusedInactive = rec {
inherit background text indicator;
border = toString scheme.withHashtag.${accentColour};
childBorder = border;
};
unfocused = rec {
inherit background text indicator;
border = toString base03;
childBorder = border;
};
}; };
startup = [ startup = [
{command = "dunst";} {command = "${pkgs.swaynotificationcenter}/bin/swaync";}
{command = "waybar";} {command = "${pkgs.swaybg}/bin/swaybg -i ${../../wallpapers/waves/cat-waves.png}";}
{command = "${pkgs.waybar}/bin/waybar";}
{command = "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";}
{command = "${pkgs.protonmail-bridge}/bin/protonmail-bridge -n";}
]; ];
assigns = { assigns = {
"3: Files" = [ "3: Files" = [
@ -55,6 +76,43 @@
{class = "^org.prismlauncher.PrismLauncher$";} {class = "^org.prismlauncher.PrismLauncher$";}
]; ];
}; };
window = {
commands = [
{
command = "floating enable";
criteria = {app_id = "org.kde.polkit-kde-authentication-agent-1";};
}
{
command = "floating enable";
criteria = {app_id = "Pinentry";};
}
{
command = "floating enable";
criteria = {app_id = "pavucontrol";};
}
{
command = "floating enable";
criteria = {app_id = ".blueman-manager-wrapped";};
}
{
command = "floating enable";
criteria = {app_id = "nm-connection-editor";};
}
{
command = "floating enable";
criteria = {app_id = "org.prismlauncher.PrismLauncher";};
}
];
};
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
"${modifier}+F1" = "exec swaylock";
"${modifier}+e" = "exec emacsclient -c";
"${modifier}+w" = "exec firefox";
"${modifier}+f" = "exec thunar";
};
}; };
}; };
} }

18
home/sway/swayfx.nix Normal file
View file

@ -0,0 +1,18 @@
{pkgs, ...}: {
imports = [./default.nix];
wayland.windowManager.sway = {
package = pkgs.swayfx;
extraConfig = ''
corner_radius 10
blur enable
blur_xray disable
blur_passes 3
blur_radius 5
corner_radius 10
shadows enable
shadow_blur_radius 4
titlebar_separator enable
scratchpad_minimize disable
'';
};
}

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: {
config,
pkgs,
...
}: {
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
package = pkgs.swaylock-effects; package = pkgs.swaylock-effects;
@ -13,7 +9,7 @@
indicator-caps-lock = true; indicator-caps-lock = true;
ignore-empty-password = true; ignore-empty-password = true;
show-failed-attempts = true; show-failed-attempts = true;
effect-blur = with config.wayland.windowManager.hyprland.settings.decoration.blur; "${toString size}x${toString passes}"; effect-blur = "5x3";
effect-vignette = "0.5:0.5"; effect-vignette = "0.5:0.5";
grace = 2; grace = 2;
fade-in = 0.2; fade-in = 0.2;

View file

@ -17,8 +17,8 @@
position = "top"; position = "top";
# Layout # Layout
"modules-left" = [ "modules-left" = [
"hyprland/workspaces" "sway/workspaces"
"hyprland/window" "sway/window"
]; ];
"modules-center" = [ "modules-center" = [
"mpris" "mpris"
@ -36,8 +36,36 @@
"tray" "tray"
]; ];
# Module config # Module config
"hyprland/window" = { "sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "󰟀 ";
"2" = "󰝚 ";
"3" = "󱧶 ";
"4" = "󰭻 ";
"5" = "󰹁 ";
"6" = "󰫃 ";
"7" = "󰫄 ";
"8" = "󰫅 ";
"9" = "󰫆 ";
"10" = "󰫇 ";
default = "󰫈 ";
urgent = "󰁡 ";
};
# show-special = false;
# sort-by-number = true;
all-outputs = false;
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
};
};
"sway/window" = {
"format" = "{title}"; "format" = "{title}";
"max-length" = 50;
"rewrite" = { "rewrite" = {
"(.*) - GNU Emacs at (.*)" = " $1 [$2]"; "(.*) - GNU Emacs at (.*)" = " $1 [$2]";
"(Alacritty.*)" = " $1"; "(Alacritty.*)" = " $1";
@ -57,34 +85,6 @@
"(X2Go Client)" = "󰢹 $1"; "(X2Go Client)" = "󰢹 $1";
"(NoMachine|Nxplayer.bin) (.*)" = "󰢹 $1 $2"; "(NoMachine|Nxplayer.bin) (.*)" = "󰢹 $1 $2";
}; };
"separate-outputs" = true;
};
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "󰟀 ";
"2" = "󰝚 ";
"3" = "󱧶 ";
"4" = "󰭻 ";
"5" = "󰹁 ";
"6" = "󰫃 ";
"7" = "󰫄 ";
"8" = "󰫅 ";
"9" = "󰫆 ";
"10" = "󰫇 ";
default = "󰫈 ";
urgent = "󰁡 ";
};
show-special = false;
sort-by-number = true;
all-outputs = false;
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
};
}; };
mpris = { mpris = {
"format" = "{status_icon} {player_icon} {artist} - {title}"; "format" = "{status_icon} {player_icon} {artist} - {title}";

View file

@ -22,6 +22,7 @@
gsettings-desktop-schemas gsettings-desktop-schemas
hunspell hunspell
hunspellDicts.en_GB-large hunspellDicts.en_GB-large
swaybg
swayimg swayimg
swaylock-effects swaylock-effects
pamixer pamixer
@ -98,7 +99,11 @@
}; };
}; };
xdg = { xdg = {
portal.enable = true; portal = {
enable = true;
config.common.default = "*"; # TODO change for xdg-desktop-portal > 1.17 changes
extraPortals = [pkgs.xdg-desktop-portal-gtk];
};
mime = let mime = let
emacs = ["emacsclient.desktop" "emacs.desktop"]; emacs = ["emacsclient.desktop" "emacs.desktop"];
browser = ["firefox.desktop"]; browser = ["firefox.desktop"];

View file

@ -1,4 +1,5 @@
{...}: { {...}: {
imports = [./desktop.nix];
powerManagement.enable = true; powerManagement.enable = true;
services.auto-cpufreq = { services.auto-cpufreq = {
enable = true; enable = true;