310 current 1970-01-01 01:00:00 23.11.20240514.9ddcaff 6.1.90 *

This commit is contained in:
Max Känner 2024-05-18 16:24:54 +02:00
parent d35f27ea11
commit 2283f4b660
3 changed files with 103 additions and 80 deletions

View File

@ -41,15 +41,8 @@
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
''; '';
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
in { in {
imports = [./kanshi.nix ./waybar.nix ./theme.nix]; imports = [./kanshi.nix ./waybar.nix ./theme.nix ./mako.nix];
options = { options = {
sway.enable = lib.mkEnableOption "sway, a lightweight window manager"; sway.enable = lib.mkEnableOption "sway, a lightweight window manager";
@ -60,9 +53,10 @@ in {
sway.kanshi.enable = lib.mkDefault true; sway.kanshi.enable = lib.mkDefault true;
sway.waybar.enable = lib.mkDefault true; sway.waybar.enable = lib.mkDefault true;
sway.theming.enable = lib.mkDefault true; sway.theming.enable = lib.mkDefault true;
sway.waybar.battery = lib.mkDefault cfg.laptop; sway.mako.enable = lib.mkDefault true;
sway.waybar.backlight = lib.mkDefault cfg.laptop; sway.waybar.battery = lib.mkIf cfg.laptop (lib.mkDefault true);
sway.waybar.squeekboard = lib.mkDefault cfg.laptop; sway.waybar.backlight = lib.mkIf cfg.laptop (lib.mkDefault true);
sway.waybar.squeekboard = lib.mkIf cfg.laptop (lib.mkDefault true);
home.packages = with pkgs; [ home.packages = with pkgs; [
swaylock # screen locking swaylock # screen locking
@ -88,7 +82,8 @@ in {
bg1080 = bgdir + "/bg1080.png"; bg1080 = bgdir + "/bg1080.png";
bg1080vert = bgdir + "/bg1080vert.png"; bg1080vert = bgdir + "/bg1080vert.png";
bg4k = bgdir + "/bg4k.png"; bg4k = bgdir + "/bg4k.png";
in { in
lib.mkIf cfg.laptop {
eDP-1 = { eDP-1 = {
bg = "'${bg1080}' fit"; bg = "'${bg1080}' fit";
}; };
@ -118,16 +113,16 @@ in {
xkb_options = "caps:ctrl_modifier"; xkb_options = "caps:ctrl_modifier";
xkb_numlock = "enable"; xkb_numlock = "enable";
}; };
"type:touchpad" = { "type:touchpad" = lib.mkIf cfg.laptop {
tap = "enable"; tap = "enable";
natural_scroll = "enable"; natural_scroll = "enable";
}; };
# map laptop touchscreen to laptop display # map laptop touchscreen to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C" = { "1267:11676:ELAN2513:00_04F3:2D9C" = lib.mkIf cfg.laptop {
map_to_output = "'AU Optronics 0x4B2D Unknown'"; map_to_output = "'AU Optronics 0x4B2D Unknown'";
}; };
# map laptop stylus to laptop display # map laptop stylus to laptop display
"1267:11676:ELAN2513:00_04F3:2D9C_Stylus" = { "1267:11676:ELAN2513:00_04F3:2D9C_Stylus" = lib.mkIf cfg.laptop {
map_to_output = "'AU Optronics 0x4B2D Unknown'"; map_to_output = "'AU Optronics 0x4B2D Unknown'";
}; };
}; };
@ -165,7 +160,7 @@ in {
menu = "${pkgs.nwg-launchers}/bin/nwggrid -client"; menu = "${pkgs.nwg-launchers}/bin/nwggrid -client";
# use foot as default terminal # use foot as default terminal
terminal = "foot"; terminal = "${pkgs.foot}/bin/foot";
assigns = { assigns = {
"main" = [{app_id = "firefox";}]; "main" = [{app_id = "firefox";}];
"term" = [{app_id = "foot-startup";}]; "term" = [{app_id = "foot-startup";}];
@ -173,11 +168,6 @@ in {
}; };
bars = []; bars = [];
fonts = {
names = ["FiraCode Nerd Font"];
size = 11.0;
};
modes = { modes = {
pause-break = { pause-break = {
e = "exec --no-startup-id swaymsg exit, mode default"; e = "exec --no-startup-id swaymsg exit, mode default";
@ -189,21 +179,23 @@ in {
}; };
}; };
startup = [ startup =
[
{command = "${dbus-sway-environment}/bin/dbus-sway-environment";} {command = "${dbus-sway-environment}/bin/dbus-sway-environment";}
{command = "${configure-gtk}/bin/configure-gtk";}
{command = "${pkgs.squeekboard}/bin/squeekboard";}
{command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${pkgs.nwg-launchers}/bin/nwggrid-server -fp";} {command = "${pkgs.nwg-launchers}/bin/nwggrid-server -fp";}
{command = "${pkgs.keepassxc}/bin/keepassxc";} {command = "${pkgs.keepassxc}/bin/keepassxc";}
{command = "${pkgs.foot}/bin/foot -a foot-startup";} {command = "${pkgs.foot}/bin/foot -a foot-startup";}
{command = "${pkgs.networkmanagerapplet}/bin/nm-applet";} {command = "${pkgs.networkmanagerapplet}/bin/nm-applet";}
]
++ lib.optionals cfg.laptop [
{command = "${pkgs.squeekboard}/bin/squeekboard";}
{command = "${pkgs.rot8}/bin/rot8 -n 10 -h ${rotate_lisgd}/bin/rotate_lisgd";}
{command = "${rotate_lisgd}/bin/rotate_lisgd";}
]; ];
defaultWorkspace = "main"; defaultWorkspace = "main";
workspaceAutoBackAndForth = true; workspaceAutoBackAndForth = true;
workspaceOutputAssign = [ workspaceOutputAssign = lib.mkIf cfg.laptop [
{ {
workspace = "main"; workspace = "main";
output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"]; output = ["DP-3" "DP-4" "DP-6" "HDMI-A-1" "eDP-1"];
@ -227,35 +219,10 @@ in {
]; ];
}; };
extraConfig = '' extraConfig = lib.mkIf cfg.laptop ''
bindswitch --reload --locked lid:on exec "[ $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq '. | length') -gt 1 ] && ${pkgs.sway}/bin/swaymsg output eDP-1 disable" bindswitch --reload --locked lid:on exec "[ $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq '. | length') -gt 1 ] && ${pkgs.sway}/bin/swaymsg output eDP-1 disable"
bindswitch --reload --locked lid:off output eDP-1 enable bindswitch --reload --locked lid:off output eDP-1 enable
''; '';
}; };
services.mako = {
enable = true;
actions = true;
anchor = "top-right";
backgroundColor = "#313131";
borderColor = "#00FFEE";
progressColor = "#338833";
textColor = "#e0e0e0";
extraConfig = ''
[urgency=low]
border-color=#008877
'';
borderRadius = 10;
borderSize = 2;
height = 100;
width = 400;
defaultTimeout = 10000; # ms
font = "FiraCode Nerd Font 11";
icons = true;
markup = true;
};
}; };
} }

View File

@ -0,0 +1,29 @@
{
lib,
config,
...
}: let
cfg = config.sway.mako;
in {
options = {
sway.mako.enable = lib.mkEnableOption "mako, a notification deamon";
};
config = lib.mkIf cfg.enable {
services.mako = {
enable = true;
actions = true;
anchor = "top-right";
borderRadius = 10;
borderSize = 2;
height = 100;
width = 400;
defaultTimeout = 10000; # ms
font = "FiraCode Nerd Font 11";
icons = true;
markup = true;
};
};
}

View File

@ -5,6 +5,13 @@
... ...
}: let }: let
cfg = config.sway.theming; cfg = config.sway.theming;
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
configure-gtk = pkgs.writeShellScriptBin "configure-gtk" ''
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'Dracula'
'';
in { in {
options = { options = {
sway.theming.enable = lib.mkEnableOption "theming for sway"; sway.theming.enable = lib.mkEnableOption "theming for sway";
@ -12,6 +19,11 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
wayland.windowManager.sway.config = { wayland.windowManager.sway.config = {
fonts = {
names = ["FiraCode Nerd Font"];
size = 11.0;
};
colors = { colors = {
background = "#00000000"; background = "#00000000";
focused = { focused = {
@ -59,6 +71,10 @@ in {
smartBorders = "no_gaps"; smartBorders = "no_gaps";
}; };
window.titlebar = false; window.titlebar = false;
startup = [
{command = "${configure-gtk}/bin/configure-gtk";}
];
}; };
gtk = { gtk = {
@ -99,5 +115,16 @@ in {
x11.defaultCursor = "capitaine-cursors-white"; x11.defaultCursor = "capitaine-cursors-white";
}; };
xsession.enable = true; xsession.enable = true;
services.mako = {
backgroundColor = "#313131";
borderColor = "#00FFEE";
progressColor = "#338833";
textColor = "#e0e0e0";
extraConfig = ''
[urgency=low]
border-color=#008877
'';
};
}; };
} }