refactor: extract sway config

This commit is contained in:
Michael Mandl 2024-07-10 12:49:11 +02:00
parent 4f5cdea23f
commit f73b6206cd
Signed by: mandlm
GPG key ID: 088ED38F036C7AF2
5 changed files with 15 additions and 15 deletions

146
sway/default.nix Normal file
View file

@ -0,0 +1,146 @@
{ config, lib, pkgs, ... }:
let
font.name = "DejaVu Sans Mono";
font.size = 12.0;
lock_command = "${pkgs.swaylock-effects}/bin/swaylock --daemonize --screenshots --effect-blur 8x2 --ignore-empty-password --show-failed-attempts";
swaymsg = "${pkgs.sway}/bin/swaymsg";
in
{
imports = [
./i3status-rust.nix
./dunst.nix
];
home.packages = with pkgs; [
xdg-utils
shotman
wl-clipboard
];
programs.fuzzel = {
enable = true;
settings = {
main = {
terminal = "${pkgs.kitty}/bin/kitty";
layer = "overlay";
font = "DejaVu Sans Mono:size=12";
};
colors = {
background = "002b36ff";
border = "ffffffaa";
};
};
};
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
};
home.pointerCursor = {
name = "Adwaita";
package = pkgs.adwaita-icon-theme;
size = 24;
x11 = {
enable = true;
defaultCursor = "Adwaita";
};
};
services.swayidle = {
enable = true;
events = [
{ event = "before-sleep"; command = lock_command; }
];
timeouts = [
{ timeout = 900; command = "${swaymsg} output '*' power off"; resumeCommand = "${swaymsg} output '*' power on"; }
{ timeout = 1000; command = lock_command; }
];
};
services.swayosd.enable = true;
services.poweralertd.enable = true;
wayland.windowManager.sway = {
enable = true;
config = {
window = {
border = 0;
titlebar = false;
};
modifier = "Mod4";
terminal = "${pkgs.kitty}/bin/kitty";
input = {
"type:keyboard" = {
xkb_layout = "de";
xkb_variant = "nodeadkeys";
xkb_options = "caps:escape";
};
"type:touchpad" = {
natural_scroll = "enabled";
tap = "enabled";
accel_profile = "flat";
dwt = "enabled";
};
};
seat = {
"*" = {
hide_cursor = "5000";
};
};
defaultWorkspace = "1";
focus.newWindow = "urgent";
fonts = {
names = [ font.name ];
size = font.size;
};
bars = [{
mode = "hide";
position = "top";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
fonts = {
names = [ font.name ];
size = font.size;
};
}];
menu = "${pkgs.fuzzel}/bin/fuzzel";
keybindings =
let
modifier = config.wayland.windowManager.sway.config.modifier;
in
lib.mkOptionDefault {
"${modifier}+Shift+s" = "exec shotman --capture region --copy";
"${modifier}+l" = "exec ${lock_command}";
"${modifier}+Shift+m" = "output '*' power off, output '*' power on, exec ${pkgs.kanshi}/bin/kanshictl reload";
"--release Caps_Lock" = "exec swayosd --caps-lock";
"XF86AudioRaiseVolume" = "exec swayosd --output-volume raise";
"XF86AudioLowerVolume" = "exec swayosd --output-volume lower";
"XF86AudioMute" = "exec swayosd --output-volume mute-toggle";
"XF86AudioMicMute" = "exec swayosd --input-volume mute-toggle";
};
startup = [
{ command = "keepassxc"; }
{ command = "kitty"; }
{ command = "element-desktop"; }
{ command = "thunderbird"; }
{ command = "firefox"; }
];
};
};
}

34
sway/dunst.nix Normal file
View file

@ -0,0 +1,34 @@
{ ... }:
{
services.dunst = {
enable = true;
settings = {
global = {
follow = "keyboard";
font = "DejaVu Sans Mono 11";
frame_width = 1;
};
urgency_low = {
frame_color = "#268bd2";
foreground = "#eee8d5";
background = "#002b36";
timeout = 4;
};
urgency_normal = {
frame_color = "#859900";
foreground = "#eee8d5";
background = "#002b36";
timeout = 6;
};
urgency_critical = {
frame_color = "#dc322f";
foreground = "#eee8d5";
background = "#002b36";
timeout = 8;
};
};
};
}

34
sway/i3status-rust.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
programs.i3status-rust = {
enable = true;
bars = {
default = {
theme = "solarized-dark";
icons = "awesome6";
blocks = [
{
block = "net";
format = " $icon { ($ssid) |}";
click = [{
button = "left";
cmd = "${pkgs.iwgtk}/bin/iwgtk";
}];
}
{
block = "battery";
missing_format = "";
format = " $icon {($time h) |}$percentage ";
}
{
block = "time";
interval = 60;
format = " $icon $timestamp.datetime(f:'%a %d.%m %R') ";
}
];
};
};
};
}