2022-03-23 21:07:18 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let switch_window = pkgs.writeScript "switchWindow" ''
|
|
|
|
# https://www.reddit.com/r/swaywm/comments/krd0sq/comment/gib6z73/?context=3
|
|
|
|
jq_filter='
|
|
|
|
# descend to workspace or scratchpad
|
|
|
|
.nodes[].nodes[]
|
|
|
|
# save workspace name as .w
|
|
|
|
| {"w": .name} + (
|
|
|
|
if (.nodes|length) > 0 then # workspace
|
|
|
|
[recurse(.nodes[])]
|
|
|
|
else # scratchpad
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
+ .floating_nodes
|
|
|
|
| .[]
|
|
|
|
# select nodes with no children (windows)
|
|
|
|
| select(.nodes==[])
|
|
|
|
)
|
|
|
|
| [
|
|
|
|
"<span size=\"xx-small\">\(.id)</span>",
|
|
|
|
# remove markup and index from workspace name, replace scratch with "[S]"
|
|
|
|
"<span size=\"xx-small\">\(.w | gsub("^[^:]*:|<[^>]*>"; "") | sub("__i3_scratch"; "[S]"))</span>",
|
|
|
|
# get app name (or window class if xwayland)
|
|
|
|
"<span weight=\"bold\">\(if .app_id == null then .window_properties.class else .app_id end)</span>",
|
|
|
|
"<span style=\"italic\">\(.name)</span>"
|
|
|
|
] | @tsv
|
|
|
|
'
|
|
|
|
${pkgs.sway}/bin/swaymsg -t get_tree | jq -r "$jq_filter" | ${pkgs.wofi} -m --insensitive --show dmenu --prompt='Focus a window' | {
|
|
|
|
read -r id name && swaymsg "[con_id=$id]" focus
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
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
|
2022-03-20 14:39:46 +00:00
|
|
|
./ibus.nix
|
2022-03-06 09:21:11 +00:00
|
|
|
];
|
2022-03-23 21:11:53 +00:00
|
|
|
home.file.".config/wofi/config".text = ''
|
2022-03-23 21:07:18 +00:00
|
|
|
allow_markup = true
|
|
|
|
dmenu-parse_action = true
|
|
|
|
'';
|
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-01-18 14:02:20 +00:00
|
|
|
"DP-1" = {
|
|
|
|
mode = "2560x1440@74.971Hz";
|
|
|
|
position = "0 0";
|
|
|
|
subpixel = "rgb";
|
|
|
|
adaptive_sync = "on";
|
|
|
|
};
|
|
|
|
"HDMI-A-1" = {
|
|
|
|
mode = "1920x1080@60Hz";
|
|
|
|
position = "2560 0";
|
|
|
|
subpixel = "rgb";
|
|
|
|
};
|
|
|
|
};
|
2022-01-19 08:28:39 +00:00
|
|
|
keybindings =
|
|
|
|
let
|
|
|
|
modifier = config.wayland.windowManager.sway.config.modifier;
|
|
|
|
in
|
|
|
|
lib.mkOptionDefault {
|
|
|
|
"${modifier}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
|
|
|
|
"${modifier}+d" = "exec ${pkgs.wofi}/bin/wofi --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-01-19 09:44:59 +00:00
|
|
|
Print = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp -d)" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
|
2022-01-19 09:49:07 +00:00
|
|
|
w = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r '.. | select(.focused?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"')" - | ${pkgs.wl-clipboard}/bin/wl-copy'';
|
2022-01-19 09:26:27 +00:00
|
|
|
f = ''exec ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy'';
|
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
|
|
|
};
|
2022-01-18 15:55:32 +00:00
|
|
|
wrapperFeatures.gtk = true;
|
2022-01-18 13:12:43 +00:00
|
|
|
};
|
2022-01-19 10:16:54 +00:00
|
|
|
|
2022-03-18 16:36:48 +00:00
|
|
|
home.file.".XCompose".source = ../../extra/.XCompose;
|
2022-01-18 14:02:20 +00:00
|
|
|
}
|