557 lines
17 KiB
Nix
557 lines
17 KiB
Nix
{ config, pkgs, lib, ...}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.my.sway;
|
|
lock = "${pkgs.swaylock-effects}/bin/swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 10 --fade-in 0.2 --submit-on-touch";
|
|
in
|
|
{
|
|
imports = [./default.nix];
|
|
|
|
options.my.sway = with pkgs.lib; {
|
|
KDEConnect = mkOption {
|
|
default = true;
|
|
type = types.bool;
|
|
description = "enable KDEConnect support";
|
|
};
|
|
xwayland = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = "enable xwayland support";
|
|
};
|
|
mail = mkOption {
|
|
default = true;
|
|
type = types.bool;
|
|
description = "enable mail support (thunderbird)";
|
|
};
|
|
nextcloud = mkOption {
|
|
default = true;
|
|
type = types.bool;
|
|
description = "enable nextcloud support";
|
|
};
|
|
XMPP = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = "enable XMPP support ()";
|
|
};
|
|
};
|
|
|
|
config = mkMerge [
|
|
(mkIf cfg.KDEConnect {
|
|
services.kdeconnect = {
|
|
enable = true;
|
|
indicator = true;
|
|
};
|
|
})
|
|
{
|
|
home.sessionVariables = {
|
|
_JAVA_AWT_WM_NONREPARENTING = "1";
|
|
SDL_VIDEODRIVER = "wayland";
|
|
QT_QPA_PLATFORM = "wayland";
|
|
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
|
|
XDG_CURRENT_DESKTOP = "sway";
|
|
};
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
# sway
|
|
# alacritty
|
|
# swayidle
|
|
# swaylock-effects
|
|
# mako
|
|
# wl-clipboard
|
|
#- xdg-desktop-portal-wlr
|
|
# bemenu
|
|
# i3blocks
|
|
# acpi
|
|
# lm_sensors
|
|
# ponymix
|
|
# brightnessctl
|
|
# gammastep
|
|
# grim
|
|
# slurp
|
|
# kdeconnect
|
|
# wdisplays
|
|
];
|
|
|
|
services.poweralertd.enable = true;
|
|
|
|
services.kanshi = {
|
|
enable = true;
|
|
profiles = {
|
|
way.outputs = [{
|
|
criteria = "Japan Display Inc. 0x364C Unknown";
|
|
status = "enable";
|
|
scale = 1.25;
|
|
}];
|
|
homeleft.outputs = [{
|
|
criteria = "Japan Display Inc. 0x364C Unknown";
|
|
status = "enable";
|
|
scale = 1.25;
|
|
position = "0,0";
|
|
} {
|
|
criteria = "LG Electronics LG HDR 4K 0x0000655D";
|
|
status = "enable";
|
|
scale = 1.0;
|
|
position = "2400,0";
|
|
mode = "3840x2160";
|
|
}];
|
|
};
|
|
};
|
|
|
|
wayland.windowManager.sway =
|
|
let
|
|
ws1 = "1💬";
|
|
#ws2 = "2📝";
|
|
ws2 = "2🌟";
|
|
ws3 = "3🍁";
|
|
ws4 = "4🍀";
|
|
ws5 = "5🌈";
|
|
ws6 = "6💎";
|
|
ws7 = "7🎥";
|
|
ws8 = "8🌍";
|
|
ws9 = "9🔒";
|
|
ws10 = "10🌀";
|
|
|
|
white = "#ffffff";
|
|
cyan = "#00afd7";
|
|
transcyan = "#00afd762";
|
|
aqua = "#00d787";
|
|
violet = "#800080";
|
|
wine = "#72003e";
|
|
magenta = "#af005f";
|
|
orange = "#ff8700";
|
|
silver = "#e4e4e4";
|
|
gray = "#353535";
|
|
elegant = "#1b1d1e";
|
|
black = "#000000";
|
|
transparent = "#000000b2";
|
|
|
|
modifier = "Mod4";
|
|
menu = "bemenu-run -i -p 'Run:' --fn 'pango:monospace 7'";
|
|
# config.wayland.windowManager.sway.config.modifier;
|
|
in {
|
|
enable = true;
|
|
xwayland = cfg.xwayland;
|
|
config = {
|
|
input = {
|
|
"*" = {
|
|
xkb_layout = "de";
|
|
xkb_model = "chromebook";
|
|
# no click needed
|
|
tap = "enabled";
|
|
};
|
|
"1452:544:Apple,_Inc_Apple_Keyboard" = {
|
|
xkb_layout = "us";
|
|
};
|
|
};
|
|
output = {
|
|
"*".bg = "~/.config/wallpaper.png fill";
|
|
## fireThink
|
|
#"Unknown 0x226D 0x00000000" = {
|
|
# enable = "";
|
|
#};
|
|
## fireG0
|
|
#"Unknown 0x405C 0x00000000" = {
|
|
# position = "0 0";
|
|
# # scale = "0.7";
|
|
# # resolution = "1920x1080";
|
|
# resolution = "1366x768@60Hz";
|
|
#};
|
|
## fireEmerald
|
|
#"Unknown 0x364C 0x00000000" = {
|
|
# position = "0 0";
|
|
# scale = "1.25";
|
|
# # does it work?
|
|
# enable = "";
|
|
#};
|
|
# "Japan Display Inc. 0x364C Unknown" = {
|
|
# position = "0 0";
|
|
# scale = "1.25";
|
|
# enable = "";
|
|
# };
|
|
# "LG Electronics LG HDR 4K 0x0000655D" = {
|
|
# position = "2400 0";
|
|
# enable = "";
|
|
# scale = "1.0";
|
|
# # disable = true;
|
|
# # resolution = "3840x2160@30Hz";
|
|
# resolution = "3840x2160";
|
|
# };
|
|
# "Goldstar Company Ltd LG HDR 4K 0x0000655D" = {
|
|
# position = "2400 0";
|
|
# enable = "";
|
|
# scale = "1.0";
|
|
# # disable = true;
|
|
# # resolution = "3840x2160@30Hz";
|
|
# resolution = "3840x2160";
|
|
# };
|
|
#"HEADLESS-1" = {
|
|
# resolution = "2560x1440";
|
|
#};
|
|
#"DP-1" = {
|
|
# position = "3000 0";
|
|
# # resolution = "2560x1440";
|
|
#};
|
|
# "DP-2" = {
|
|
# position = "1920 0";
|
|
# # position = "4480 0";
|
|
# # resolution = "1280x1024";
|
|
# };
|
|
};
|
|
modifier = "${modifier}";
|
|
menu = "${menu}";
|
|
terminal = "alacritty";
|
|
fonts = { names = ["monospace"]; style = "monospace"; size = 7.0;};
|
|
colors = {
|
|
focused = { background = "${transcyan}"; border = "${transcyan}"; childBorder = "${transcyan}"; indicator = "${white}"; text = "${elegant}"; };
|
|
focusedInactive = { background = "${transparent}"; border = "${transparent}"; childBorder = "${transparent}"; indicator = "${magenta}"; text = "${cyan}"; };
|
|
unfocused = { background = "${transparent}"; border = "${transparent}"; childBorder = "${transparent}"; indicator = "${white}"; text = "${orange}"; };
|
|
urgent = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${magenta}"; text = "${silver}"; };
|
|
placeholder = { background = "${magenta}"; border = "${magenta}"; childBorder = "${magenta}"; indicator = "${white}"; text = "${silver}"; };
|
|
background = "${transparent}";
|
|
};
|
|
bars = [{
|
|
position = "top";
|
|
statusCommand = "i3blocks";
|
|
trayOutput = "*";
|
|
colors = {
|
|
statusline = "${white}";
|
|
# focusedStatusline = "${white}";
|
|
background = "${transparent}";
|
|
# focusedBackground = "${transparent}";
|
|
activeWorkspace = { background = "${gray}"; border = "${gray}"; text = "${white}"; };
|
|
focusedWorkspace = { background = "${cyan}"; border = "${gray}"; text = "${white}"; };
|
|
inactiveWorkspace = { background = "${black}"; border = "${black}"; text = "${orange}"; };
|
|
urgentWorkspace = { background = "${magenta}"; border = "${magenta}"; text = "${white}"; };
|
|
bindingMode = { background = "${orange}"; border = "${orange}"; text = "${white}"; };
|
|
};
|
|
}];
|
|
window = {
|
|
border = 1;
|
|
titlebar = false;
|
|
# hideEdgeBorders = "smart_no_gaps";
|
|
hideEdgeBorders = "smart";
|
|
commands = [
|
|
{ command = "move to scratchpad"; criteria = { title = "Firefox.* Sharing Indicator"; }; }
|
|
{ command = "sticky enable"; criteria = { title = "Picture-in-Picture"; }; }
|
|
{ command = "floating enable"; criteria = { title = "Picture-in-Picture"; }; }
|
|
{ command = "floating enable"; criteria = { title = "Extension: \(Tree Style Tab\) - .*"; }; }
|
|
];
|
|
};
|
|
gaps = {
|
|
inner = 2;
|
|
outer = 0;
|
|
smartGaps = true;
|
|
smartBorders = "no_gaps";
|
|
};
|
|
modes.resize = {
|
|
Left = "resize shrink width 10 px or 10 ppt";
|
|
Down = "resize grow height 10 px or 10 ppt";
|
|
Up = "resize shrink height 10 px or 10 ppt";
|
|
Right = "resize grow 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";
|
|
h = "resize shrink width 10 px or 10 ppt";
|
|
|
|
Return = "mode default";
|
|
Escape = "mode default";
|
|
"${modifier}+r" = "mode default";
|
|
};
|
|
workspaceAutoBackAndForth = true;
|
|
keybindings = {
|
|
"${modifier}+Return" = "exec alacritty";
|
|
# "${modifier}+Return" = "exec ${config.wayland.windowManager.sway.config.terminal}";
|
|
"${modifier}+Shift+c" = "reload";
|
|
"${modifier}+Shift+r" = "restart";
|
|
"${modifier}+c" = "kill";
|
|
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway?' -b 'Yes, exit sway' 'swaymsg exit'";
|
|
|
|
"${modifier}+Shift+h" = "split h";
|
|
"${modifier}+Shift+v" = "split v";
|
|
|
|
"${modifier}+z" = "fullscreen toggle";
|
|
|
|
"${modifier}+s" = "layout stacking";
|
|
"${modifier}+w" = "layout tabbed";
|
|
"${modifier}+e" = "layout toggle split";
|
|
|
|
"${modifier}+Shift+space" = "floating toggle";
|
|
"${modifier}+space" = "focus mode_toggle";
|
|
"${modifier}+a" = "focus parent";
|
|
"${modifier}+d" = "focus child";
|
|
"${modifier}+v" = "exec ${menu}";
|
|
|
|
"${modifier}+x" = "sticky toggle";
|
|
"${modifier}+Shift+x" = "move workspace to output left";
|
|
|
|
"${modifier}+r" = "mode resize";
|
|
|
|
# window
|
|
"${modifier}+Left" = "focus left";
|
|
"${modifier}+Down" = "focus down";
|
|
"${modifier}+Up" = "focus up";
|
|
"${modifier}+Right" = "focus right";
|
|
"${modifier}+j" = "focus left";
|
|
"${modifier}+k" = "focus down";
|
|
"${modifier}+l" = "focus up";
|
|
"${modifier}+odiaeresis" = "focus right";
|
|
|
|
"${modifier}+Shift+Left" = "move left";
|
|
"${modifier}+Shift+Down" = "move down";
|
|
"${modifier}+Shift+Up" = "move up";
|
|
"${modifier}+Shift+Right" = "move right";
|
|
"${modifier}+Shift+j" = "move left";
|
|
"${modifier}+Shift+k" = "move down";
|
|
"${modifier}+Shift+l" = "move up";
|
|
"${modifier}+Shift+odiaeresis" = "move right";
|
|
|
|
# workspace
|
|
"${modifier}+1" = "workspace number ${ws1}";
|
|
"${modifier}+2" = "workspace number ${ws2}";
|
|
"${modifier}+3" = "workspace number ${ws3}";
|
|
"${modifier}+4" = "workspace number ${ws4}";
|
|
"${modifier}+5" = "workspace number ${ws5}";
|
|
"${modifier}+6" = "workspace number ${ws6}";
|
|
"${modifier}+7" = "workspace number ${ws7}";
|
|
"${modifier}+8" = "workspace number ${ws8}";
|
|
"${modifier}+9" = "workspace number ${ws9}";
|
|
"${modifier}+0" = "workspace number ${ws10}";
|
|
|
|
"${modifier}+Shift+1" = "move container to workspace number ${ws1}";
|
|
"${modifier}+Shift+2" = "move container to workspace number ${ws2}";
|
|
"${modifier}+Shift+3" = "move container to workspace number ${ws3}";
|
|
"${modifier}+Shift+4" = "move container to workspace number ${ws4}";
|
|
"${modifier}+Shift+5" = "move container to workspace number ${ws5}";
|
|
"${modifier}+Shift+6" = "move container to workspace number ${ws6}";
|
|
"${modifier}+Shift+7" = "move container to workspace number ${ws7}";
|
|
"${modifier}+Shift+8" = "move container to workspace number ${ws8}";
|
|
"${modifier}+Shift+9" = "move container to workspace number ${ws9}";
|
|
"${modifier}+Shift+0" = "move container to workspace number ${ws10}";
|
|
|
|
"XF86AudioLowerVolume" = "exec ponymix -N decrease 5";
|
|
"${modifier}+XF86AudioLowerVolume" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') decrease 5"'';
|
|
"XF86AudioRaiseVolume" = "exec ponymix -N increase 5";
|
|
"${modifier}+XF86AudioRaiseVolume" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') increase 5"'';
|
|
|
|
"XF86AudioMute" = "exec ponymix -N toggle";
|
|
|
|
"${modifier}+XF86AudioMute" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') toggle"'';
|
|
"XF86AudioMicMute" = ''exec "ponymix -N -t source -d $(ponymix -t source list | grep source | grep -v -E '(monitor|fallback)' | sed -r 's/source\s([0-9]+):.*/\1/') toggle"'';
|
|
|
|
"XF86MonBrightnessUp" = ''exec brightnessctl set +10% && \
|
|
notify-send -h "int:value:$(brightnessctl -m info | cut -d',' -f4)" -i display-brightness-symbolic -a Display Light -t 1000'';
|
|
"XF86MonBrightnessDown" = ''exec brightnessctl set 10%- && \
|
|
notify-send -h "int:value:$(brightnessctl -m info | cut -d',' -f4)" -i display-brightness-symbolic -a Display Light -t 1000'';
|
|
"XF86Display" = ''exec "swaymsg output eDP-1 toggle"'';
|
|
|
|
"${modifier}+p" = "exec passmenu";
|
|
|
|
"${modifier}+F11" = ''exec "${lock}"'';
|
|
"Print" = ''exec "grim -g \"$(slurp)\""'';
|
|
};
|
|
assigns = {
|
|
"${ws1}" = [
|
|
{ app_id = "(?i)empathy"; }
|
|
{ app_id = "(?i)gajim"; }
|
|
{ app_id = "(?i)dino"; }
|
|
{ app_id = "(?i)pidgin"; }
|
|
];
|
|
"${ws2}" = [
|
|
{ app_id = "(?i)thunderbird"; }
|
|
{ app_id = "(?i)evolution"; }
|
|
];
|
|
"${ws4}" = [
|
|
{ app_id = "(?i)atril"; }
|
|
{ app_id = "(?i)evince"; }
|
|
];
|
|
"${ws7}" = [
|
|
{ app_id = "(?i)mpv"; }
|
|
];
|
|
"${ws8}" = [
|
|
{ app_id = "(?i)firefox"; }
|
|
{ app_id = "(?i)firefoxdeveloperedition"; }
|
|
];
|
|
};
|
|
floating = {
|
|
modifier = modifier;
|
|
};
|
|
startup = [
|
|
# { command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK"; }
|
|
# { command = "hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK" ; }
|
|
# { command = "swayidle -w \\
|
|
# timeout 300 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch' \\
|
|
# timeout 600 'swaymsg output * dpms off' \\
|
|
# resume 'swaymsg output * dpms on' \\
|
|
# before-sleep 'swaylock -SeFfk --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --grace 2 --fade-in 0.2 --submit-on-touch'"; }
|
|
#{ command = "mako"; }
|
|
#{ command = "kanshi"; }
|
|
# indicator
|
|
{ command = "networkd-notify"; }
|
|
# needs x11
|
|
#{ command = "udiskie -t"; }
|
|
#{ command = "modem-manager-gui -i"; }
|
|
#{ command = "nm-applet"; }
|
|
# apps
|
|
{ command = "firefox"; }
|
|
#{ command = "firefoxdeveloperedition"; }
|
|
] ++ lib.optionals (cfg.mail) [
|
|
{ command = "thunderbird"; }
|
|
] ++ lib.optionals (cfg.nextcloud) [
|
|
{ command = "nextcloud"; }
|
|
] ++ lib.optionals (cfg.XMPP) [
|
|
{ command = "dino"; }
|
|
#{ command = "gajim"; }
|
|
];
|
|
};
|
|
extraConfig = ''
|
|
set $laptop eDP-1
|
|
bindswitch --reload --locked lid:on output $laptop disable
|
|
bindswitch --reload --locked lid:off output $laptop enable
|
|
exec_always "cat /proc/acpi/button/lid/*/state | grep -q open && swaymsg output $laptop enable || swaymsg output $laptop disable"
|
|
'';
|
|
};
|
|
services.swayidle = {
|
|
enable = true;
|
|
timeouts = [
|
|
{ timeout = 300; command = "${lock}"; }
|
|
{ timeout = 600; command = "${pkgs.sway}/bin/swaymsg output * dpms off"; }
|
|
];
|
|
events = [
|
|
{ event = "before-sleep"; command = "${lock}"; }
|
|
{ event = "after-resume"; command = "${pkgs.sway}/bin/swaymsg output * dpms on"; }
|
|
];
|
|
};
|
|
|
|
# use nixos's ....
|
|
# from programs.sway:
|
|
# xdg.portal.enable = true;
|
|
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
|
|
|
|
services.mako = {
|
|
enable = true;
|
|
font = "monospace 7";
|
|
iconPath = "/home/genofire/.nix-profile/share/icons/Adwaita/:/home/genofire/.nix-profile/share/icons/hicolor/";
|
|
maxIconSize = 32;
|
|
margin = "2";
|
|
padding = "3";
|
|
width = 380;
|
|
|
|
format = "<b>[%a] %s %h</b>\\n%b";
|
|
|
|
maxVisible = 14;
|
|
# layer = "overlay";
|
|
groupBy = "app-name,summary";
|
|
sort = "+time";
|
|
|
|
backgroundColor = "#000000bf";
|
|
borderColor = "#000000bf";
|
|
#borderColor = "#00afd7";
|
|
borderRadius = 4;
|
|
extraConfig = ''
|
|
[app-name=""]
|
|
width=380
|
|
|
|
[app-name=""]
|
|
format=<b>%s %h</b>\n%b
|
|
|
|
[app-name="notify-send"]
|
|
format=<b>%s %h</b>\n%b
|
|
|
|
[grouped]
|
|
format=(%g) <b>[%a] %s %h</b>\n%b
|
|
|
|
[actionable]
|
|
border-radius=4
|
|
|
|
[urgency=low]
|
|
border-color=#00d787a0
|
|
progress-color=over #00d78760
|
|
|
|
[urgency=normal]
|
|
progress-color=over #1c1c1ca0
|
|
#progress-color=over #00afd7a0
|
|
|
|
[urgency=high]
|
|
border-color=#af005fa0
|
|
progress-color=over #af005f60
|
|
|
|
[app-icon="kdeconnect"]
|
|
format=<b>%s %h</b>\n%b
|
|
border-color=#353535
|
|
background-color=#1b1d1e
|
|
border-size=1
|
|
anchor=top-left
|
|
'';
|
|
};
|
|
|
|
services.gammastep = {
|
|
enable = true;
|
|
provider = "geoclue2";
|
|
# duskTime = "22:00-23:00";
|
|
# dawnTime = "6:00-10:00";
|
|
};
|
|
|
|
programs.alacritty = {
|
|
enable = true;
|
|
settings = {
|
|
window.opacity = 0.95;
|
|
font.size = 8;
|
|
colors.primary = {
|
|
background = "0x000000";
|
|
foreground = "0xffffff";
|
|
};
|
|
};
|
|
};
|
|
|
|
xdg.configFile."i3blocks/bin/wifi".source = ./sway-i3block/wifi;
|
|
xdg.configFile."i3blocks/bin/battery".source = ./sway-i3block/battery;
|
|
xdg.configFile."i3blocks/config".text = ''
|
|
align=center
|
|
separator=true
|
|
separator_block_width=15
|
|
markup=pango
|
|
# color=#f8f8f2
|
|
color=#e4e4e4
|
|
# background=#00afd7
|
|
|
|
[root]
|
|
label= 💽
|
|
command=df -h / | awk 'FNR==2 { gsub(/[A-Za-z]/, ""); printf " %i<span color=\"#589df6\">G</span>\n", $4 }'
|
|
interval=3
|
|
|
|
[memory]
|
|
label= 💾
|
|
command=free --giga | awk 'FNR==2{ printf " %i<span color=\"#589df6\">G</span>\n", $7 }'
|
|
interval=2
|
|
|
|
[wifi]
|
|
label=
|
|
command=~/.config/i3blocks/bin/wifi
|
|
interval=5
|
|
color=#589df6
|
|
|
|
[volume]
|
|
command=if ponymix -t sink is-muted; then echo '🔇'; else if test $(ponymix -t sink get-volume) -gt 50; then echo -n "🔊"; else echo -n "🔉"; fi; echo "$(ponymix -t sink get-volume)<span color=\"#589df6\">%</span>"; fi
|
|
interval=1
|
|
|
|
[mic]
|
|
command=if ponymix -t source is-muted; then echo '<span color="#ffffff"></span>'; else echo "<span color=\"#ff5555\"> $(ponymix -t source get-volume)%</span>"; fi
|
|
interval=1
|
|
|
|
[battery]
|
|
command=~/.config/i3blocks/bin/battery
|
|
interval=2
|
|
color=#ff5555
|
|
|
|
[time]
|
|
label=⏰
|
|
command=date '+%T'
|
|
interval=1
|
|
'';
|
|
}];
|
|
}
|