2021-02-12 21:12:03 +01:00
|
|
|
|
{ config, lib, nixosConfig, pkgs, ... }:
|
2020-11-07 14:13:43 +01:00
|
|
|
|
let
|
2021-01-04 12:40:31 +01:00
|
|
|
|
# Source: “境目” by 3211 on Pixiv: https://www.pixiv.net/en/artworks/39266182
|
2022-02-07 20:09:25 +01:00
|
|
|
|
wallpaperUnfree = pkgs.runCommand
|
|
|
|
|
"wallpaper-unfree"
|
|
|
|
|
{
|
|
|
|
|
meta.license = lib.licenses.unfree;
|
|
|
|
|
}
|
|
|
|
|
''
|
|
|
|
|
${pkgs.waifu2x-converter-cpp}/bin/waifu2x-converter-cpp \
|
|
|
|
|
-i ${pkgs.fetchurl {
|
|
|
|
|
url = "https://i.pximg.net/img-original/img/2013/10/22/04/25/37/39266182_p0.jpg";
|
|
|
|
|
sha256 = "053gc9jd4cbkkwgcirrhpzbn933dfh83l30p1sz55m5d8zx1lk65";
|
|
|
|
|
curlOpts = "--referer https://pixiv.net";
|
|
|
|
|
}} \
|
|
|
|
|
-o out.png
|
|
|
|
|
# -o $out does not work
|
|
|
|
|
cp out.png $out
|
|
|
|
|
'';
|
2021-01-03 17:07:45 +01:00
|
|
|
|
wallpaperFree = pkgs.fetchurl {
|
|
|
|
|
url = "https://raw.githubusercontent.com/swaywm/sway/3b2bc894a5ebbcbbd6707d45a25d171779c2e874/assets/Sway_Wallpaper_Blue_1920x1080.png";
|
|
|
|
|
sha256 = "1rkqd0h7w64plibn7k3krk5vdc3pnv3fc7m2xc2mxnwrbsgngwsz";
|
|
|
|
|
|
|
|
|
|
meta.license = lib.licenses.cc0;
|
|
|
|
|
};
|
2021-02-12 21:12:03 +01:00
|
|
|
|
wallpaper = if nixosConfig.sbruder.unfree.allowAssets then wallpaperUnfree else wallpaperFree;
|
2020-12-02 21:39:42 +01:00
|
|
|
|
|
2020-11-07 14:13:43 +01:00
|
|
|
|
cfg = config.wayland.windowManager.sway.config;
|
|
|
|
|
in
|
2021-07-17 14:10:02 +02:00
|
|
|
|
{
|
|
|
|
|
imports = lib.optionals nixosConfig.sbruder.gui.enable [
|
|
|
|
|
./gammastep.nix
|
|
|
|
|
./kanshi.nix
|
2022-05-01 18:25:21 +02:00
|
|
|
|
./swaync.nix
|
2021-07-17 14:10:02 +02:00
|
|
|
|
./waybar.nix
|
|
|
|
|
./xdg-desktop-portal.nix
|
|
|
|
|
];
|
|
|
|
|
} // (lib.mkIf nixosConfig.sbruder.gui.enable {
|
|
|
|
|
|
2020-11-07 14:13:43 +01:00
|
|
|
|
wayland.windowManager.sway = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
modifier = "Mod4";
|
|
|
|
|
|
2022-07-06 01:09:59 +02:00
|
|
|
|
terminal = "foot";
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
|
|
|
|
menu = "${pkgs.dmenu-wayland}/bin/dmenu-wl_path | ${pkgs.dmenu-wayland}/bin/dmenu-wl -nb '#002b36' -nf '#839496' -sb '#859900' -sf '#073642' | ${pkgs.findutils}/bin/xargs swaymsg exec --";
|
|
|
|
|
|
2021-03-07 17:38:35 +01:00
|
|
|
|
output."*".bg = "${wallpaper} fill";
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
2021-10-05 23:13:23 +02:00
|
|
|
|
input = {
|
|
|
|
|
"type:keyboard" = {
|
|
|
|
|
xkb_layout = "de";
|
|
|
|
|
xkb_options = "compose:caps";
|
|
|
|
|
xkb_numlock = "enable";
|
|
|
|
|
};
|
|
|
|
|
} // (lib.optionalAttrs (nixosConfig.networking.hostName == "mayushii") {
|
|
|
|
|
"type:touchpad".events = "disabled";
|
2021-10-07 21:14:01 +02:00
|
|
|
|
"2:10:TPPS/2_Elan_TrackPoint".pointer_accel = "-0.15";
|
2021-10-05 23:13:23 +02:00
|
|
|
|
});
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
|
|
|
|
keybindings = {
|
|
|
|
|
# Basics
|
|
|
|
|
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
|
|
|
|
|
"${cfg.modifier}+Shift+c" = "kill";
|
|
|
|
|
"${cfg.modifier}+r" = "exec ${cfg.menu}";
|
|
|
|
|
"${cfg.modifier}+Control+r" = "reload";
|
|
|
|
|
"${cfg.modifier}+Shift+q" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
|
|
|
|
|
|
|
|
|
# Focus
|
|
|
|
|
"${cfg.modifier}+${cfg.left}" = "focus left";
|
|
|
|
|
"${cfg.modifier}+${cfg.down}" = "focus down";
|
|
|
|
|
"${cfg.modifier}+${cfg.up}" = "focus up";
|
|
|
|
|
"${cfg.modifier}+${cfg.right}" = "focus right";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+Left" = "focus left";
|
|
|
|
|
"${cfg.modifier}+Down" = "focus down";
|
|
|
|
|
"${cfg.modifier}+Up" = "focus up";
|
|
|
|
|
"${cfg.modifier}+Right" = "focus right";
|
|
|
|
|
|
|
|
|
|
# Moving
|
|
|
|
|
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
|
|
|
|
|
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
|
|
|
|
|
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
|
|
|
|
|
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+Shift+Left" = "move left";
|
|
|
|
|
"${cfg.modifier}+Shift+Down" = "move down";
|
|
|
|
|
"${cfg.modifier}+Shift+Up" = "move up";
|
|
|
|
|
"${cfg.modifier}+Shift+Right" = "move right";
|
|
|
|
|
|
|
|
|
|
# Workspaces
|
|
|
|
|
"${cfg.modifier}+1" = "workspace number 1";
|
|
|
|
|
"${cfg.modifier}+2" = "workspace number 2";
|
|
|
|
|
"${cfg.modifier}+3" = "workspace number 3";
|
|
|
|
|
"${cfg.modifier}+4" = "workspace number 4";
|
|
|
|
|
"${cfg.modifier}+5" = "workspace number 5";
|
|
|
|
|
"${cfg.modifier}+6" = "workspace number 6";
|
|
|
|
|
"${cfg.modifier}+7" = "workspace number 7";
|
|
|
|
|
"${cfg.modifier}+8" = "workspace number 8";
|
|
|
|
|
"${cfg.modifier}+9" = "workspace number 9";
|
|
|
|
|
"${cfg.modifier}+0" = "workspace number 10";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+Shift+1" = "move container to workspace number 1";
|
|
|
|
|
"${cfg.modifier}+Shift+2" = "move container to workspace number 2";
|
|
|
|
|
"${cfg.modifier}+Shift+3" = "move container to workspace number 3";
|
|
|
|
|
"${cfg.modifier}+Shift+4" = "move container to workspace number 4";
|
|
|
|
|
"${cfg.modifier}+Shift+5" = "move container to workspace number 5";
|
|
|
|
|
"${cfg.modifier}+Shift+6" = "move container to workspace number 6";
|
|
|
|
|
"${cfg.modifier}+Shift+7" = "move container to workspace number 7";
|
|
|
|
|
"${cfg.modifier}+Shift+8" = "move container to workspace number 8";
|
|
|
|
|
"${cfg.modifier}+Shift+9" = "move container to workspace number 9";
|
|
|
|
|
"${cfg.modifier}+Shift+0" = "move container to workspace number 10";
|
|
|
|
|
|
|
|
|
|
# Moving workspaces between outputs
|
|
|
|
|
"${cfg.modifier}+Control+${cfg.left}" = "move workspace to output left";
|
|
|
|
|
"${cfg.modifier}+Control+${cfg.down}" = "move workspace to output down";
|
|
|
|
|
"${cfg.modifier}+Control+${cfg.up}" = "move workspace to output up";
|
|
|
|
|
"${cfg.modifier}+Control+${cfg.right}" = "move workspace to output right";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+Control+Left" = "move workspace to output left";
|
|
|
|
|
"${cfg.modifier}+Control+Down" = "move workspace to output down";
|
|
|
|
|
"${cfg.modifier}+Control+Up" = "move workspace to output up";
|
|
|
|
|
"${cfg.modifier}+Control+Right" = "move workspace to output right";
|
|
|
|
|
|
|
|
|
|
# Splits
|
|
|
|
|
"${cfg.modifier}+b" = "splith";
|
|
|
|
|
"${cfg.modifier}+v" = "splitv";
|
|
|
|
|
|
|
|
|
|
# Layouts
|
|
|
|
|
"${cfg.modifier}+s" = "layout stacking";
|
|
|
|
|
"${cfg.modifier}+t" = "layout tabbed";
|
|
|
|
|
"${cfg.modifier}+e" = "layout toggle split";
|
|
|
|
|
"${cfg.modifier}+f" = "fullscreen toggle";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+a" = "focus parent";
|
|
|
|
|
|
|
|
|
|
"${cfg.modifier}+Control+space" = "floating toggle";
|
|
|
|
|
"${cfg.modifier}+space" = "focus mode_toggle";
|
|
|
|
|
|
|
|
|
|
# Scratchpad
|
|
|
|
|
"${cfg.modifier}+Shift+minus" = "move scratchpad";
|
|
|
|
|
"${cfg.modifier}+minus" = "scratchpad show";
|
|
|
|
|
|
|
|
|
|
# Resize mode
|
|
|
|
|
"${cfg.modifier}+d" = "mode resize";
|
|
|
|
|
|
|
|
|
|
# Multimedia Keys
|
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
|
|
|
|
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
|
|
|
|
"--locked XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
|
|
|
|
"--locked XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
|
|
|
|
|
2021-03-29 16:20:24 +02:00
|
|
|
|
"XF86AudioPrev" = "exec ${pkgs.mpc_cli}/bin/mpc -q next";
|
|
|
|
|
"XF86AudioNext" = "exec ${pkgs.mpc_cli}/bin/mpc -q prev";
|
|
|
|
|
"XF86AudioPlay" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle";
|
2021-11-18 18:33:18 +01:00
|
|
|
|
"XF86AudioPause" = "exec ${pkgs.mpc_cli}/bin/mpc -q toggle";
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
2020-12-10 20:23:53 +01:00
|
|
|
|
# Mumble PTT
|
|
|
|
|
"--no-repeat Shift_R" = "exec ${pkgs.dbus}/bin/dbus-send --session --type=method_call --dest=net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble.startTalking";
|
|
|
|
|
"--no-repeat --release Shift_R" = "exec ${pkgs.dbus}/bin/dbus-send --session --type=method_call --dest=net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble.stopTalking";
|
|
|
|
|
# reset
|
|
|
|
|
"Shift_R+Shift" = "exec ${pkgs.dbus}/bin/dbus-send --session --type=method_call --dest=net.sourceforge.mumble.mumble / net.sourceforge.mumble.Mumble.stopTalking";
|
|
|
|
|
|
2020-11-07 14:13:43 +01:00
|
|
|
|
# Locking and DPMS
|
|
|
|
|
"${cfg.modifier}+y" = "exec ${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}";
|
2022-05-31 15:02:51 +02:00
|
|
|
|
"--no-repeat --locked ${cfg.modifier}+q" = "output - dpms toggle";
|
2022-05-01 18:25:21 +02:00
|
|
|
|
|
|
|
|
|
# Notifications
|
2022-05-31 14:35:00 +02:00
|
|
|
|
"${cfg.modifier}+n" = "exec ${pkgs.swaynotificationcenter}/bin/swaync-client -t";
|
2020-11-07 14:13:43 +01:00
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 09:31:22 +01:00
|
|
|
|
bars = [ ]; # managed as systemd user unit
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
|
|
|
|
assigns = {
|
|
|
|
|
"2" = [
|
|
|
|
|
{ app_id = "firefox"; }
|
2021-11-09 21:45:50 +01:00
|
|
|
|
{ app_id = "org.qutebrowser.qutebrowser"; }
|
2021-11-20 16:45:30 +01:00
|
|
|
|
{ class = "qutebrowser"; } # workaround for qutebrowser running under Xwayland
|
2020-11-07 14:13:43 +01:00
|
|
|
|
#{ class="Chromium"; }
|
|
|
|
|
];
|
|
|
|
|
"3" = [
|
|
|
|
|
{ app_id = "net.sourceforge.mumble."; }
|
|
|
|
|
{ class = "Claws-mail"; }
|
|
|
|
|
];
|
|
|
|
|
"4" = [
|
|
|
|
|
{ app_id = "anki"; }
|
|
|
|
|
{ app_id = "libreoffice-startcenter"; }
|
|
|
|
|
{ app_id = "net.sourceforge.gscan2pdf"; }
|
|
|
|
|
{ app_id = "org.pwmt.zathura"; }
|
|
|
|
|
{ app_id = "xournalpp"; }
|
|
|
|
|
];
|
|
|
|
|
"5" = [
|
|
|
|
|
{ app_id = "audacious"; }
|
|
|
|
|
{ app_id = "pavucontrol"; }
|
|
|
|
|
];
|
|
|
|
|
"8" = [
|
|
|
|
|
{ app_id = "darktable"; }
|
|
|
|
|
{ app_id = "org.inkscape.Inkscape"; }
|
|
|
|
|
{ class = "Blender"; }
|
|
|
|
|
{ class = "Gimp"; }
|
|
|
|
|
{ class = "krita"; }
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.border = 1;
|
|
|
|
|
|
|
|
|
|
floating = {
|
|
|
|
|
titlebar = true;
|
|
|
|
|
border = 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
colors = {
|
|
|
|
|
focused = rec { border = "#93a1a1"; background = "#073642"; text = "#93a1a1"; indicator = "#2aa198"; childBorder = background; };
|
|
|
|
|
focusedInactive = rec { border = "#839496"; background = "#002b36"; text = "#839496"; indicator = "#2aa198"; childBorder = background; };
|
|
|
|
|
unfocused = rec { border = "#839496"; background = "#002b36"; text = "#839496"; indicator = "#2aa198"; childBorder = background; };
|
|
|
|
|
urgent = rec { border = "#073642"; background = "#dc322f"; text = "#073642"; indicator = "#2aa198"; childBorder = background; };
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-24 22:12:33 +02:00
|
|
|
|
fonts = {
|
|
|
|
|
names = [ "monospace" ];
|
|
|
|
|
style = "Regular";
|
|
|
|
|
size = 10.0;
|
|
|
|
|
};
|
2020-11-07 14:13:43 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
# Cursor
|
|
|
|
|
seat seat0 xcursor_theme Adwaita
|
2021-05-02 07:56:03 +02:00
|
|
|
|
'' + (
|
|
|
|
|
let
|
|
|
|
|
environmentVariables = lib.concatStringsSep " " [
|
|
|
|
|
"DBUS_SESSION_BUS_ADDRESS"
|
|
|
|
|
"DISPLAY"
|
|
|
|
|
"SWAYSOCK"
|
|
|
|
|
"WAYLAND_DISPLAY"
|
|
|
|
|
];
|
|
|
|
|
in
|
|
|
|
|
''
|
|
|
|
|
# From https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start
|
|
|
|
|
exec systemctl --user import-environment ${environmentVariables} && \
|
|
|
|
|
hash dbus-update-activation-environment 2>/dev/null && \
|
|
|
|
|
dbus-update-activation-environment --systemd ${environmentVariables} && \
|
|
|
|
|
systemctl --user start sway-session.target
|
|
|
|
|
''
|
|
|
|
|
);
|
2021-03-11 19:07:32 +01:00
|
|
|
|
};
|
2020-11-07 14:13:43 +01:00
|
|
|
|
|
2021-05-02 07:56:03 +02:00
|
|
|
|
systemd.user.targets.sway-session = {
|
|
|
|
|
Unit = {
|
|
|
|
|
Description = "sway compositor session";
|
|
|
|
|
Documentation = [ "man:systemd.special(7)" ];
|
|
|
|
|
BindsTo = [ "graphical-session.target" ];
|
|
|
|
|
Wants = [ "graphical-session-pre.target" ];
|
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-02 09:31:53 +01:00
|
|
|
|
systemd.user.services.swayidle = {
|
|
|
|
|
Unit.PartOf = [ "sway-session.target" ];
|
|
|
|
|
Install.WantedBy = [ "sway-session.target" ];
|
|
|
|
|
|
|
|
|
|
Service = {
|
2021-05-02 07:56:03 +02:00
|
|
|
|
# swayidle requires sh and swaymsg to be in path
|
|
|
|
|
Environment = "PATH=${pkgs.bash}/bin:${config.wayland.windowManager.sway.package}/bin";
|
2021-03-02 09:31:53 +01:00
|
|
|
|
ExecStart = ''
|
|
|
|
|
${pkgs.swayidle}/bin/swayidle -w \
|
|
|
|
|
timeout 300 "${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}" \
|
|
|
|
|
timeout 300 'swaymsg "output * dpms off"' \
|
|
|
|
|
resume 'swaymsg "output * dpms on"' \
|
|
|
|
|
before-sleep "${pkgs.swaylock}/bin/swaylock -f -i ${wallpaper}"
|
|
|
|
|
'';
|
|
|
|
|
Restart = "on-failure";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-04 09:39:14 +01:00
|
|
|
|
xdg.configFile."swaynag/config".text =
|
|
|
|
|
let
|
|
|
|
|
# adding it to the header doesn’t work since the defaults overwrite it
|
2021-08-05 13:23:07 +02:00
|
|
|
|
commonConfig = /* ini */ ''
|
2021-03-04 09:39:14 +01:00
|
|
|
|
background=fdf6e3
|
|
|
|
|
border-bottom=eee8d5
|
|
|
|
|
border=eee8d5
|
2021-04-30 19:22:08 +02:00
|
|
|
|
button-background=fdf6e3
|
|
|
|
|
button-text=657b83
|
2021-03-04 09:39:14 +01:00
|
|
|
|
'';
|
|
|
|
|
in
|
2021-08-05 13:23:07 +02:00
|
|
|
|
/* ini */ ''
|
2021-03-04 09:39:14 +01:00
|
|
|
|
font=Monospace 12
|
|
|
|
|
|
|
|
|
|
[warning]
|
|
|
|
|
text=b58900
|
|
|
|
|
${commonConfig}
|
|
|
|
|
|
|
|
|
|
[error]
|
|
|
|
|
text=dc322f
|
|
|
|
|
${commonConfig}
|
|
|
|
|
'';
|
2021-03-02 12:26:06 +01:00
|
|
|
|
|
2021-07-17 14:10:02 +02:00
|
|
|
|
# Start on tty1
|
2021-08-05 13:23:07 +02:00
|
|
|
|
programs.zsh.initExtra = /* sh */ ''
|
2021-07-17 14:10:02 +02:00
|
|
|
|
if [[ -z $WAYLAND_DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
|
|
|
|
|
export XDG_SESSION_TYPE="wayland" # otherwise set to tty
|
|
|
|
|
unset __HM_SESS_VARS_SOURCED __NIXOS_SET_ENVIRONMENT_DONE # otherwise sessionVariables are not updated
|
|
|
|
|
exec systemd-cat -t sway sway
|
|
|
|
|
fi
|
|
|
|
|
'';
|
2021-03-07 17:38:35 +01:00
|
|
|
|
|
2021-07-17 14:10:02 +02:00
|
|
|
|
home.sessionVariables = {
|
|
|
|
|
CLUTTER_BACKEND = "wayland";
|
|
|
|
|
GDK_BACKEND = "wayland";
|
|
|
|
|
GDK_DPI_SCALE = 1;
|
|
|
|
|
MOZ_ENABLE_WAYLAND = 1;
|
2022-05-31 14:39:42 +02:00
|
|
|
|
NIXOS_OZONE_WL = 1;
|
2021-07-17 14:10:02 +02:00
|
|
|
|
QT_QPA_PLATFORM = "wayland-egl";
|
|
|
|
|
QT_WAYLAND_DISABLE_WINDOWDECORATION = 1;
|
|
|
|
|
SDL_VIDEODRIVER = "wayland";
|
|
|
|
|
WLR_NO_HARDWARE_CURSORS = 1;
|
|
|
|
|
_JAVA_AWT_WM_NONREPARENTING = 1;
|
|
|
|
|
_JAVA_OPTIONS = "-Dawt.useSystemAAFontSettings=on";
|
2020-11-07 15:04:49 +01:00
|
|
|
|
};
|
2021-07-10 16:27:26 +02:00
|
|
|
|
|
2021-07-17 14:10:02 +02:00
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
|
brightnessctl # control screen brightness
|
|
|
|
|
sway-contrib.grimshot # screenshots
|
2022-04-02 08:51:37 +02:00
|
|
|
|
waypipe # forward application over ssh
|
2021-07-17 14:10:02 +02:00
|
|
|
|
wdisplays # graphical output manager
|
|
|
|
|
];
|
|
|
|
|
})
|