Initial switch to sway

This commit is contained in:
Valentin Brandl 2024-08-10 12:27:56 +02:00
parent 5a58ab78a6
commit c2bf499c19
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9
8 changed files with 277 additions and 2 deletions

View File

@ -30,7 +30,6 @@ user:
./pasystray.nix
./photography.nix
./picom.nix
./polybar.nix
./programs.nix
./qt.nix
./redshift.nix
@ -39,10 +38,12 @@ user:
./rofi.nix
./rust.nix
./signal.nix
./sway.nix
./telegram.nix
./thunderbird.nix
./tmux.nix
./tor.nix
./waybar.nix
./xdg.nix
./zathura.nix
./zoom.nix

7
home/gammastep.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }: {
services.gammastep = {
enable = true;
longitude = "49.01315";
latitude = "12.1119";
};
}

View File

@ -27,6 +27,9 @@ let
mode_system = "System: L : | S : | P : | R : | E : ";
in {
imports = [
./polybar.nix
];
home.packages = with pkgs; [
# i3lock
dmenu

153
home/sway.nix Normal file
View File

@ -0,0 +1,153 @@
{ lib, pkgs, ... }:
let
mod = "Mod4";
ws1 = "1: www";
ws2 = "2: >_";
ws3 = "3: </>";
ws4 = "4: IM";
ws5 = "5: ./";
ws6 = "6: doc";
ws7 = "7: mail";
ws8 = "8";
ws9 = "9";
ws10 = "10: media";
mode_system = "System: L : | S : | P : | R : | E : ";
in {
imports = [
./gammastep.nix
];
home.packages = with pkgs; [
slurp # screenshot selection
grim # screenshots
wl-clipboard # copy/paste
swaybg # background images
];
# similar to i3-lock-fancy
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
screenshots = true;
effect-blur = "7x5";
clock = true;
indicator = true;
indicator-thickness = 7;
};
};
wayland.windowManager.sway = {
enable = true;
swaynag.enable = true;
config = {
modifier = mod;
workspaceAutoBackAndForth = true;
fonts = {
names = [ "NotoSans-Regular" "FontAwesome" ];
style = "Monospace";
size = 12.0;
};
/* TODO: background
output = {
"*" = {
bg = "/home/me/media/Pictures/wallpapers/gargantua-black-3840x2160-11475.jpg fill";
};
};
*/
assigns = {
"${ws1}" = [ { app_id = "firefox"; } ];
"${ws5}" = [ { app_id="thunar"; } ];
"${ws7}" = [ { class="Thunderbird"; } ];
};
floating = {
criteria = [
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
{ title = "Preferences$"; }
{ app_id = "org.keepassxc.KeePassXC"; }
{ app_id = "pavucontrol"; }
{ class = "^Pinentry-gtk-2$"; }
];
};
terminal = "alacritty";
keybindings = lib.mkOptionDefault {
"${mod}+b" = "split h";
"${mod}+v" = "split v";
"${mod}+s" = "layout stacking";
"${mod}+w" = "layout tabbed";
"${mod}+e" = "layout toggle split";
"${mod}+space" = "focus mode_toggle";
"${mod}+d" = "exec rofi -show drun";
"${mod}+Tab" = "exec rofi -show window";
"${mod}+1" = "workspace ${ws1}";
"${mod}+2" = "workspace ${ws2}";
"${mod}+3" = "workspace ${ws3}";
"${mod}+4" = "workspace ${ws4}; layout tabbed";
"${mod}+5" = "workspace ${ws5}";
"${mod}+6" = "workspace ${ws6}";
"${mod}+7" = "workspace ${ws7}; layout tabbed";
"${mod}+8" = "workspace ${ws8}";
"${mod}+9" = "workspace ${ws9}";
"${mod}+0" = "workspace ${ws10}";
"${mod}+Shift+1" = "move container to workspace ${ws1}";
"${mod}+Shift+2" = "move container to workspace ${ws2}";
"${mod}+Shift+3" = "move container to workspace ${ws3}";
"${mod}+Shift+4" = "move container to workspace ${ws4}";
"${mod}+Shift+5" = "move container to workspace ${ws5}";
"${mod}+Shift+6" = "move container to workspace ${ws6}";
"${mod}+Shift+7" = "move container to workspace ${ws7}";
"${mod}+Shift+8" = "move container to workspace ${ws8}";
"${mod}+Shift+9" = "move container to workspace ${ws9}";
"${mod}+Shift+0" = "move container to workspace ${ws10}";
"${mod}+Shift+r" = "reload";
"${mod}+r" = "mode \"resize\"";
"${mod}+x" = "mode \"${mode_system}\"";
"${mod}+Shift+x" = "exec swaylock";
};
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";
Return = "mode \"default\"";
Escape = "mode \"default\"";
"${mod}+r" = "mode \"default\"";
};
"${mode_system}" = {
l = "exec ~/bin/lock.sh, mode \"default\"";
s = "exec $Lock systemctl suspend, mode \"default\"";
p = "exec systemctl poweroff -i, mode \"default\"";
r = "exec systemctl reboot, mode \"default\"";
e = "exec i3-msg exit, mode \"default\"";
# back to normal: Enter or Escape or mod+x again
Return = "mode \"default\"";
Escape = "mode \"default\"";
"${mod}+x" = "mode \"default\"";
};
};
window = {
hideEdgeBorders = "both";
# disable titlebar
titlebar = false;
};
};
};
}

100
home/waybar.nix Normal file
View File

@ -0,0 +1,100 @@
{ pkgs, ... }: {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 30;
output = [
"eDP-1"
"HDMI-A-1"
];
modules-left = ["sway/workspaces" "sway/mode"];
#modules-center = ["sway/window"];
modules-right = [
"pulseaudio"
"network"
"disk"
"memory"
"cpu"
"battery"
"clock#date"
"clock#time"
"tray"
];
"disk" = {
format = "Disk {percentage_free}%";
};
"pulseaudio" = {
format = "{volume}% {format_source}";
on-click = "pavucontrol";
};
"cpu" = {
format = "CPU {usage}% ({load})";
states = {
warning = "70";
critical = "90";
};
};
"memory" = {
format = "Mem {}%";
states = {
warning = "70";
critical = "90";
};
};
"network" = {
format-wifi = " {essid} ({signalStrength}%)";
format-ethernet = " {ifname}: {ipaddr}/{cidr}";
format-disconnected = " Disconnected";
};
"battery" = {
states = {
warning = "30";
critical = "15";
};
format = " {icon} {capacity}%";
format-discharging = "{icon} {capacity}%";
format-icons = [
""
""
""
""
""
];
};
tray = {
icon-size = 21;
spacing = 10;
};
"clock#time" = {
interval = 1;
format = "{:%H:%M:%S}";
};
"clock#date" = {
format = "{:%e %B %Y}";
};
"sway/workspaces" = {
all-outputs = false;
};
};
};
package = pkgs.waybar.override {
pulseSupport = true;
#i3Support = true;
};
};
}

View File

@ -87,7 +87,8 @@ inputs:
};
displayManager = {
defaultSession = "none+i3";
#defaultSession = "none+i3";
defaultSession = "sway";
};
xserver = {

View File

@ -15,6 +15,7 @@ inputs.nixpkgs.lib.nixosSystem {
nixpkgs.overlays = [ overlay-unstable ];
})
(import ./common.nix inputs)
(import ./sway.nix inputs)
(import ./morpheus/btrbk.nix inputs)
(import ./dev.nix inputs)
(import ./entertainment.nix inputs)

9
machines/sway.nix Normal file
View File

@ -0,0 +1,9 @@
inputs:
{ config, lib, pkgs, ... }: {
services.gnome.gnome-keyring.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}