configure sway

This commit is contained in:
Astreaprtcl 2025-12-19 01:54:22 +01:00
parent 61ecbd9721
commit f9138672e8
17 changed files with 322 additions and 25 deletions

View file

@ -1,11 +1,10 @@
{ config, lib, pkgs, home-manager, ... }:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.users.mara;
in
with lib;
{
options.users.mara.enable = mkEnableOption "Enable the user Mara";
@ -22,6 +21,7 @@ with lib;
username = "mara";
homeDirectory = "/home/mara";
};
custom.backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
programs.fish.enable = true;

View file

@ -3,8 +3,11 @@
{
imports = [
./fish.nix
./fuzzel.nix
./helix.nix
./kitty.nix
./nix.nix
./sway.nix
./swww.nix
];
}

View file

@ -0,0 +1,35 @@
{ ... }:
{
programs.fuzzel = {
enable = true;
settings = {
main = {
icons-enabled = "no";
font = "Maple Mono NF:size=12";
dpi-aware = "no";
horizontal-pad = 8;
vertical-pad = 8;
inner-pad = 8;
width = 64;
};
colors = {
background = "23213688";
text = "e0def4ff";
prompt = "e0def4ff";
input = "e0def4ff";
match = "8f66c6ff";
selection = "eb6f92ff";
selection-text = "232136ff";
selection-match = "232136ff";
border = "8f66c6ff";
};
border = {
width = 2;
radius = 2;
};
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ lib, pkgs, ... }:
{
programs.helix = {
@ -20,7 +20,7 @@
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt}/bin/nixfmt";
formatter.command = "${lib.getExe pkgs.nixfmt-rfc-style} -s";
}
];

View file

@ -10,6 +10,8 @@
size = 11;
};
shellIntegration.enableFishIntegration = true;
settings = {
confirm_os_window_close = 0;
enable_audio_bell = false;
@ -56,7 +58,7 @@
window_margin_width = 3;
tab_bar_style = "separator";
tab_seperator = "|";
tab_seperator = "| ";
tab_bar_margin_width = 3;
tab_bar_margin_height = 3;
tab_switch_strategy = "right";

View file

@ -0,0 +1,8 @@
{ ... }:
{
programs.nix-index = {
enable = true;
enableFishIntegration = true;
};
}

View file

@ -1,12 +1,179 @@
{ ... }:
{ config, lib, pkgs, ... }:
let
inherit (lib) concatMapStringsSep getExe getExe';
in
{
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
shadows enable
shadow_blur_radius 16
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
'';
config = rec {
modifier = "Mod4";
terminal = "kitty";
modifier = "Mod1";
input."*" = {
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
output."BOE 0x0BCA Unknown".scale = "1.5";
seat = {
"*".hide_cursor = "when-typing enable";
seat0.fallback = "true";
seat1."\r" = concatMapStringsSep "\n " (s: " attach ${s}") [
"9390:4610:Rapoo_Rapoo_Gaming_Device"
"9390:4610:Rapoo_Rapoo_Gaming_Device_Keyboard"
];
};
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" = "exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${getExe pkgs.fuzzel} -d'";
# Focus
"${modifier}+Down" = "focus down";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Up" = "focus up";
# Movement
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Up" = "move up";
# Toggle
"${modifier}+Shift+f" = "fullscreen toggle";
"${modifier}+Shift+space" = "floating toggle";
# Workspaces
"${modifier}+Ctrl+Left" = "workspace prev";
"${modifier}+Ctrl+Right" = "workspace next";
"${modifier}+Ctrl+Shift+Left" = "move window to workspace prev";
"${modifier}+Ctrl+Shift+Right" = "move window to workspace next";
"${modifier}+1" = "workspace number 1";
"${modifier}+Shift+1" = "move window to workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+Shift+2" = "move window to workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+Shift+3" = "move window to workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+Shift+4" = "move window to workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+Shift+5" = "move window to workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+Shift+6" = "move window to workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+Shift+7" = "move window to workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+Shift+8" = "move window to workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+Shift+9" = "move window to workspace number 9";
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
# Shadow Dimension
"${modifier}+Shift+Tab" = "move scratchpad";
"${modifier}+Tab" = "scratchpad show";
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}";
# dmenu
"${modifier}+d" = "exec ${getExe pkgs.fuzzel}";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
};
focusedInactive = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
unfocused = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
urgent = {
background = "#2f343a";
border = "#900000";
childBorder = "#ffffff";
indicator = "#900000";
text = "#900000";
};
placeholder = {
background = "#000000";
border = "#0c0c0c";
childBorder = "#ffffff";
indicator = "#000000";
text = "#0c0c0c";
};
};
gaps = {
inner = 5;
outer = 0;
};
floating = {
border = 2;
titlebar = false;
};
window = {
border = 2;
titlebar = false;
commands = [
{
criteria.app_id = ".*";
command = "inhibit_idle fullscreen";
}
{
criteria.app_id = "org\.keepassxc\.KeePassXC";
command = "floating enable";
}
{
criteria.app_id = "xfce-polkit";
command = "floating enable";
}
];
};
};
};
}

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) getExe getExe' mkOption types;
in
{
options.custom.backgroundDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
type = with types; uniq str;
};
config = {
services.swww.enable = true;
systemd.user = {
services.swww-randomize = {
Unit = {
Description = "randomly change the swww background image";
Requires = "swww.service";
};
Service = {
Type = "oneshot";
ExecStart = "${getExe pkgs.bash} -c '${getExe pkgs.findutils} ${config.custom.backgroundDir} -type f | ${getExe' pkgs.coreutils "shuf"} -n 1 | ${getExe' pkgs.findutils "xargs"} ${getExe pkgs.swww} img --transition-step 16'";
};
Install.WantedBy = [ "default.target" ];
};
timers.swww-randomize = {
Unit.Description = "randomly changes the swww background image";
Timer = {
Unit = "swww-random";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}