restructure and further configure sway

This commit is contained in:
Astreaprtcl 2025-12-21 00:44:47 +01:00
parent f9138672e8
commit 8f5c2ff8f6
25 changed files with 476 additions and 256 deletions

View file

@ -1,7 +0,0 @@
{ ... }:
{
imports = [
./mara/config.nix
];
}

View file

@ -1,8 +1,9 @@
{ osConfig, ... }:
{ osConfig, lib, ... }:
{
imports = lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./default);
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
home = {
stateVersion = osConfig.system.stateVersion;

42
users/default/swww.nix Normal file
View file

@ -0,0 +1,42 @@
{
config,
lib,
pkgs,
...
}:
{
options.services.swww-randomize = {
enable = lib.mkEnableOption "enable the randomization swww service";
backgroundDir = lib.mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
description = "directory with images to use for the background";
type = with lib.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 = "${lib.getExe pkgs.bash} -c '${lib.getExe pkgs.findutils} ${config.services.swww-randomize.backgroundDir} -type f | ${lib.getExe' pkgs.coreutils "shuf"} -n 1 | ${lib.getExe' pkgs.findutils "xargs"} ${lib.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-randomize";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}

View file

@ -1,28 +1,32 @@
{ config, lib, pkgs, home-manager, ... }:
{
config,
lib,
pkgs,
home-manager,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.users.mara;
in
{
options.users.mara.enable = mkEnableOption "Enable the user Mara";
options.users.mara.enable = lib.mkEnableOption "Enable the user Mara";
config = mkIf cfg.enable {
home-manager.users.mara = { config, pkgs, ... }:
config = lib.mkIf cfg.enable {
home-manager.users.mara =
{ config, pkgs, ... }:
{
imports = [
../home-default.nix
./config/all.nix
];
{
imports = (
[ ../default.nix ] ++ lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./config)
);
home = {
username = "mara";
homeDirectory = "/home/mara";
home = {
username = "mara";
homeDirectory = "/home/mara";
};
};
custom.backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
programs.fish.enable = true;

View file

@ -1,13 +0,0 @@
{ ... }:
{
imports = [
./fish.nix
./fuzzel.nix
./helix.nix
./kitty.nix
./nix.nix
./sway.nix
./swww.nix
];
}

View file

@ -7,17 +7,17 @@
interactiveShellInit = ''
set fish_greeting
'';
functions = {
fish_prompt.body = ''
printf '%s %s > ' (set_color purple)(whoami)@(prompt_hostname) (set_color blue)(prompt_pwd)(set_color normal)
'';
fish_right_prompt.body = ''
set stat $status
set -g __fish_git_prompt_showupstream verbose
set -g __fish_git_prompt_showcolorhints 1
printf '%s %s' (fish_vcs_prompt) [(set_color red)$stat(set_color normal)]
set stat $status
set -g __fish_git_prompt_showupstream verbose
set -g __fish_git_prompt_showcolorhints 1
printf '%s %s' (fish_vcs_prompt) [(set_color red)$stat(set_color normal)]
'';
};
};

View file

@ -1,4 +1,4 @@
{ ... }:
{ pkgs, ... }:
{
programs.kitty = {
@ -8,6 +8,7 @@
font = {
name = "Maple Mono NF";
size = 11;
package = pkgs.maple-mono.NF;
};
shellIntegration.enableFishIntegration = true;

View file

@ -1,8 +1,11 @@
{ ... }:
{ pkgs, ... }:
{
programs.nix-index = {
enable = true;
enableFishIntegration = true;
programs = {
nix-index = {
enable = true;
enableFishIntegration = true;
};
nix-search-tv.enable = true;
};
}

View file

@ -1,55 +1,86 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) concatMapStringsSep getExe getExe';
inherit (lib)
concatMapStringsSep
getExe
getExe'
mkOption
types
;
in
{
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
options.custom.screenShotDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with types; uniq str;
description = "Folder for all screenshots";
};
shadows enable
shadow_blur_radius 16
config = {
services.swww-randomize = {
enable = true;
backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
'';
config = rec {
modifier = "Mod1";
shadows enable
shadow_blur_radius 16
input."*" = {
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
output."BOE 0x0BCA Unknown".scale = "1.5";
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
'';
config = rec {
modifier = "Mod1";
terminal = getExe pkgs.kitty;
menu = getExe pkgs.fuzzel;
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
{
input = {
"type:touchpad" = {
tap = "on";
};
"*" = {
accel_profile = "flat";
pointer_accel = "-0.1";
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 = {
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" = "exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${getExe pkgs.fuzzel} -d'";
"${modifier}+Shift+Escape" =
"exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${getExe' pkgs.findutils "xargs"} ${getExe' pkgs.systemd "systemctl"}";
# Focus
"${modifier}+Down" = "focus down";
@ -90,7 +121,6 @@ in
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
@ -102,77 +132,111 @@ in
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}";
"${modifier}+Return" = "exec ${terminal}";
# dmenu
"${modifier}+d" = "exec ${getExe pkgs.fuzzel}";
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" =
"exec ${getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"${modifier}+e" =
"exec ${getExe pkgs.bash} -c \"${getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${getExe' pkgs.coreutils "tr"} -d '\\n' | ${getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
# Wallpaper
"${modifier}+b" = "exec ${getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
# Notifications
"${modifier}+n" = "exec ${getExe' pkgs.dunst "dunstctl"} history-pop";
# Screenshot
"${modifier}+Shift+s" =
"exec ${getExe pkgs.bash} -c \"${getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${getExe' pkgs.coreutils "date"} -Iseconds).png; ${getExe pkgs.killall} wayfreeze'\"";
# Screenlock
"${modifier}+l" = "exec --no-startup-id ${getExe pkgs.swaylock}";
# Audio
"--locked XF86AudioLowerVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"--locked XF86AudioRaiseVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${getExe pkgs.pulsemixer} --toggle-mute";
"--locked XF86AudioMicMute" =
"exec ${getExe pkgs.pulsemixer} --toggle-mute --id $(${getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
# Brightness
"--locked XF86MonBrightnessDown" = "exec ${getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${getExe pkgs.brightnessctl} set 5%+";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
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";
};
};
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";
}
];
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,92 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getExe;
in
{
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
# Background
color = "#232136";
image = config.services.swww-randomize.backgroundDir + "/Alena_Aenami-Clouds.jpg";
# Swaylock-effects
screenshot = true;
effect-blur = "5x5";
fade-in = "1";
clock = true;
indicator = true;
datestr = "";
# Layout text colors
layout-bg-color = "#00000000";
layout-border-color = "#00000000";
layout-text-color = "#e0def4";
# Text color
text-color = "#3e8fb0";
text-clear-color = "#9ccdf8";
text-caps-lock-color = "#f6c177";
text-ver-color = "#c4a7e7";
text-wrong-color = "#eb6f92";
# Highlight segments
bs-hl-color = "#23213666";
key-hl-color = "#3e8fb0";
caps-lock-bs-hl-color = "#23213666";
caps-lock-key-hl-color = "#f6c177";
# Inside of the indicator
inside-color = "#22222add";
inside-clear-color = "#22222add";
inside-caps-lock-color = "#22222add";
inside-ver-color = "#22222add";
inside-wrong-color = "#22222add";
# Line between inside and ring
line-color = "#3e8fb011";
line-clear-color = "#9ccfd811";
line-caps-lock-color = "#f6c17711";
line-ver-color = "#c4a7e711";
line-wrong-color = "#eb6f9211";
# Indicator ring
ring-color = "#3e8fb0aa";
ring-clear-color = "#9ccfd8aa";
ring-caps-lock-color = "#f6c177aa";
ring-ver-color = "#c4a7e7aa";
ring-wrong-color = "#eb6f92aa";
# Indicator
font = "Maple Mono NF";
indicator-radius = 80;
indicator-thickness = 8;
};
};
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${getExe pkgs.brightnessctl} -s s $(($(${getExe pkgs.brightnessctl} g) / 2))";
resumeCommand = "${getExe pkgs.brightnessctl} -r";
}
{
timeout = 360;
command = "${getExe pkgs.swaylock-effects} -f";
}
];
events = {
before-sleep = "${getExe pkgs.swaylock-effects} -f";
lock = "${getExe pkgs.swaylock-effects} -f";
};
};
}

View file

@ -1,37 +0,0 @@
{ 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" ];
};
};
};
}