2022-06-12 15:39:15 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
2023-03-29 06:26:26 +00:00
|
|
|
system,
|
2022-06-12 15:39:15 +00:00
|
|
|
...
|
|
|
|
}: let
|
2023-01-01 13:28:25 +00:00
|
|
|
c = "$";
|
2022-04-14 07:27:25 +00:00
|
|
|
switch_window = pkgs.writeScript "switchWindow" ''
|
2023-01-01 13:15:47 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
tree=$(${pkgs.sway}/bin/swaymsg -t get_tree)
|
|
|
|
readarray -t win_ids <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .id' <<< "$tree")"
|
|
|
|
readarray -t win_names <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .name' <<< "$tree")"
|
|
|
|
readarray -t win_types <<< "$(${pkgs.jq}/bin/jq -r '.. | objects | select(has("app_id")) | .app_id // .window_properties.class' <<< "$tree")"
|
|
|
|
|
|
|
|
switch () {
|
|
|
|
local k
|
|
|
|
read -r k
|
|
|
|
swaymsg "[con_id=${c}{win_ids[$k]}] focus"
|
2022-04-14 07:27:25 +00:00
|
|
|
}
|
2023-01-01 13:15:47 +00:00
|
|
|
|
|
|
|
for k in $(seq 0 $((${c}{#win_ids[@]} - 1))); do
|
2023-01-01 14:39:50 +00:00
|
|
|
echo -e "<span weight=\"bold\">${c}{win_types[$k]}</span> - ${c}{win_names[$k]}"
|
2023-01-01 13:15:47 +00:00
|
|
|
done | rofi -dmenu -markup-rows -i -p window -format i | switch
|
2023-01-01 13:28:25 +00:00
|
|
|
'';
|
2022-04-14 07:27:25 +00:00
|
|
|
screenshot_then_switch = pkgs.writeScript "screenshotThenSwitch" ''
|
|
|
|
${pkgs.sway-contrib.grimshot}/bin/grimshot "$@"
|
|
|
|
${pkgs.sway}/bin/swaymsg mode default
|
|
|
|
'';
|
2022-06-22 15:13:11 +00:00
|
|
|
bg-full-res = "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl";
|
2022-06-22 19:11:28 +00:00
|
|
|
bg-1440p = pkgs.stdenvNoCC.mkDerivation {
|
2022-06-22 15:13:11 +00:00
|
|
|
name = "wayland-background-1440p.png";
|
2022-10-18 00:33:38 +00:00
|
|
|
nativeBuildInputs = [pkgs.imagemagick pkgs.libjxl];
|
2022-06-22 19:11:28 +00:00
|
|
|
src = pkgs.emptyDirectory;
|
2022-06-22 15:13:11 +00:00
|
|
|
buildPhase = ''
|
2022-10-18 00:33:38 +00:00
|
|
|
djxl ${bg-full-res} bg-full-res.png
|
|
|
|
convert bg-full-res.png -resize 2560x1440 $out
|
2022-06-22 15:13:11 +00:00
|
|
|
'';
|
|
|
|
installPhase = "true";
|
|
|
|
};
|
2022-06-22 19:11:28 +00:00
|
|
|
bg-1080p = pkgs.stdenvNoCC.mkDerivation {
|
2022-06-22 15:13:11 +00:00
|
|
|
name = "wayland-background-1080p.png";
|
2022-10-18 00:33:38 +00:00
|
|
|
nativeBuildInputs = [pkgs.imagemagick pkgs.libjxl];
|
2022-06-22 19:11:28 +00:00
|
|
|
src = pkgs.emptyDirectory;
|
2022-06-22 15:13:11 +00:00
|
|
|
buildPhase = ''
|
2022-10-18 00:33:38 +00:00
|
|
|
djxl ${bg-full-res} bg-full-res.png
|
|
|
|
convert bg-full-res.png -resize 1920x1080 $out
|
2022-06-22 15:13:11 +00:00
|
|
|
'';
|
|
|
|
installPhase = "true";
|
|
|
|
};
|
2022-06-12 15:39:15 +00:00
|
|
|
in {
|
2022-03-06 09:21:11 +00:00
|
|
|
imports = [
|
|
|
|
./wl-clipboard.nix
|
2022-03-06 09:29:25 +00:00
|
|
|
./mako.nix
|
2022-03-06 09:43:01 +00:00
|
|
|
./swayidle.nix
|
2023-01-01 09:37:59 +00:00
|
|
|
./foot.nix
|
2023-01-01 13:15:47 +00:00
|
|
|
./rofi.nix
|
2022-03-06 09:21:11 +00:00
|
|
|
];
|
2022-01-18 13:12:43 +00:00
|
|
|
wayland.windowManager.sway = {
|
2022-01-18 13:16:40 +00:00
|
|
|
enable = true;
|
2022-01-18 13:12:43 +00:00
|
|
|
config = {
|
2022-01-18 13:20:29 +00:00
|
|
|
modifier = "Mod4";
|
2022-01-18 13:12:43 +00:00
|
|
|
input = {
|
2022-01-18 13:14:12 +00:00
|
|
|
"*" = {
|
2022-01-18 13:12:43 +00:00
|
|
|
xkb_layout = "de,de";
|
|
|
|
xkb_variant = "neo_qwertz,neo";
|
2022-01-18 13:20:29 +00:00
|
|
|
xkb_options = "grp:ctrls_toggle";
|
2022-01-18 13:12:43 +00:00
|
|
|
};
|
|
|
|
};
|
2022-01-18 14:12:38 +00:00
|
|
|
output = {
|
2022-06-22 15:13:11 +00:00
|
|
|
"eDP-1" = {
|
|
|
|
bg = "${bg-1080p} fill";
|
|
|
|
};
|
2022-01-18 14:02:20 +00:00
|
|
|
"DP-1" = {
|
|
|
|
mode = "2560x1440@74.971Hz";
|
|
|
|
position = "0 0";
|
|
|
|
subpixel = "rgb";
|
|
|
|
adaptive_sync = "on";
|
2022-06-22 15:13:11 +00:00
|
|
|
bg = "${bg-1440p} fill";
|
2022-01-18 14:02:20 +00:00
|
|
|
};
|
|
|
|
"HDMI-A-1" = {
|
|
|
|
mode = "1920x1080@60Hz";
|
|
|
|
position = "2560 0";
|
|
|
|
subpixel = "rgb";
|
2022-06-22 15:13:11 +00:00
|
|
|
bg = "${bg-1080p} fill";
|
2022-01-18 14:02:20 +00:00
|
|
|
};
|
|
|
|
};
|
2022-06-12 15:39:15 +00:00
|
|
|
keybindings = let
|
2022-06-12 15:42:42 +00:00
|
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
2022-06-12 15:39:15 +00:00
|
|
|
in
|
2022-01-19 08:28:39 +00:00
|
|
|
lib.mkOptionDefault {
|
2023-01-01 09:37:59 +00:00
|
|
|
"${modifier}+Return" = "exec ${pkgs.foot}/bin/foot";
|
2023-01-01 14:39:50 +00:00
|
|
|
"${modifier}+d" = "exec ${pkgs.rofi}/bin/rofi -show drun";
|
2022-01-19 09:12:58 +00:00
|
|
|
"Print" = "mode screenshot";
|
2022-03-11 17:44:19 +00:00
|
|
|
"XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
|
|
|
"XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
|
|
|
"XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
2022-03-11 19:55:04 +00:00
|
|
|
"XF86AudioMicMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
2022-03-11 17:44:19 +00:00
|
|
|
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
|
|
|
|
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
|
|
|
|
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
|
|
|
|
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
|
|
|
|
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
|
|
|
|
"XF86AudioStop" = "exec ${pkgs.mpc-cli}/bin/mpc stop";
|
2022-03-23 21:07:18 +00:00
|
|
|
"Mod1+Tab" = "exec ${switch_window}";
|
2022-01-19 08:28:39 +00:00
|
|
|
};
|
2022-01-18 15:57:45 +00:00
|
|
|
bars = [
|
|
|
|
{
|
|
|
|
command = "${pkgs.waybar}/bin/waybar";
|
|
|
|
}
|
|
|
|
];
|
2022-01-19 09:12:58 +00:00
|
|
|
modes = {
|
|
|
|
screenshot = {
|
2022-04-14 07:27:25 +00:00
|
|
|
Print = "exec ${screenshot_then_switch} copy area";
|
2023-01-01 09:37:59 +00:00
|
|
|
"Shift+Print" = "exec ${screenshot_then_switch} save area $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
2022-04-14 07:27:25 +00:00
|
|
|
a = "exec ${screenshot_then_switch} copy active";
|
2023-01-01 09:37:59 +00:00
|
|
|
"Shift+a" = "exec ${screenshot_then_switch} save active $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
2022-04-14 07:27:25 +00:00
|
|
|
s = "exec ${screenshot_then_switch} copy screen";
|
2023-01-01 09:37:59 +00:00
|
|
|
"Shift+s" = "exec ${screenshot_then_switch} save screen $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
2022-04-14 07:27:25 +00:00
|
|
|
o = "exec ${screenshot_then_switch} copy output";
|
2023-01-01 09:37:59 +00:00
|
|
|
"Shift+o" = "exec ${screenshot_then_switch} save output $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
2022-04-14 07:27:25 +00:00
|
|
|
w = "exec ${screenshot_then_switch} copy window";
|
2023-01-01 09:37:59 +00:00
|
|
|
"Shift+w" = "exec ${screenshot_then_switch} save window $HOME/Pictures/grim-$(date --iso=s | sed 's/:/-/g').png";
|
2022-01-19 09:17:03 +00:00
|
|
|
Escape = ''mode "default"'';
|
|
|
|
Return = ''mode "default"'';
|
2022-01-19 09:12:58 +00:00
|
|
|
};
|
|
|
|
};
|
2022-01-18 14:21:38 +00:00
|
|
|
};
|
2023-01-06 09:28:49 +00:00
|
|
|
wrapperFeatures = {
|
|
|
|
base = true;
|
|
|
|
gtk = true;
|
|
|
|
};
|
2023-04-05 07:56:35 +00:00
|
|
|
extraSessionCommands =
|
|
|
|
''
|
|
|
|
export XDG_SESSION_TYPE=wayland
|
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
|
|
|
|
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
|
|
|
export QT_SCALE_FACTOR=1
|
|
|
|
export GDK_SCALE=1
|
|
|
|
export GDK_DPI_SCALE=1
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
export QT_QPA_PLATFORMTHEME=qt5ct
|
|
|
|
''
|
|
|
|
+ (
|
|
|
|
if system == "x86_64-linux"
|
|
|
|
then ''
|
|
|
|
export VK_ICD_FILENAMES=/run/opengl-driver/share/vulkan/icd.d/intel_icd.x86_64.json:/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/radeon_icd.i686.json:/run/opengl-driver-32/share/vulkan/icd.d/intel_icd.i686.json
|
|
|
|
''
|
|
|
|
else ""
|
|
|
|
);
|
2022-07-06 06:59:56 +00:00
|
|
|
extraConfig = ''
|
2023-01-01 14:39:50 +00:00
|
|
|
default_border none
|
2023-01-01 13:51:02 +00:00
|
|
|
gaps outer 8
|
|
|
|
gaps inner 4
|
2022-07-06 06:59:56 +00:00
|
|
|
'';
|
2022-01-18 13:12:43 +00:00
|
|
|
};
|
2022-01-19 10:16:54 +00:00
|
|
|
|
2022-07-17 10:57:53 +00:00
|
|
|
home.file.".XCompose".source = ../../extra/.XCompose;
|
2022-01-18 14:02:20 +00:00
|
|
|
}
|