mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 14:31:54 -05:00
home/sway: use wayland helpers
This commit is contained in:
parent
1e1a02a5b3
commit
dc2180c4cb
|
@ -12,7 +12,9 @@
|
||||||
then true
|
then true
|
||||||
else false;
|
else false;
|
||||||
|
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = let
|
||||||
|
helpers = import ../wayland/helpers.nix {inherit config lib pkgs;};
|
||||||
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
wrapperFeatures.gtk = true;
|
wrapperFeatures.gtk = true;
|
||||||
checkConfig = false;
|
checkConfig = false;
|
||||||
|
@ -27,8 +29,6 @@
|
||||||
editor = lib.getExe config.ar.home.defaultApps.editor;
|
editor = lib.getExe config.ar.home.defaultApps.editor;
|
||||||
terminal = lib.getExe config.ar.home.defaultApps.terminal;
|
terminal = lib.getExe config.ar.home.defaultApps.terminal;
|
||||||
|
|
||||||
media = lib.getExe pkgs.playerctl;
|
|
||||||
|
|
||||||
# Sway desktop utilities
|
# Sway desktop utilities
|
||||||
bar = lib.getExe pkgs.waybar;
|
bar = lib.getExe pkgs.waybar;
|
||||||
launcher = lib.getExe pkgs.fuzzel;
|
launcher = lib.getExe pkgs.fuzzel;
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
lock = lib.getExe pkgs.swaylock;
|
lock = lib.getExe pkgs.swaylock;
|
||||||
idled = pkgs.writeShellScript "sway-idled" ''
|
idled = pkgs.writeShellScript "sway-idled" ''
|
||||||
${lib.getExe pkgs.swayidle} -w \
|
${lib.getExe pkgs.swayidle} -w \
|
||||||
before-sleep '${media} pause' \
|
before-sleep '${helpers.media} pause' \
|
||||||
before-sleep '${lock}' \
|
before-sleep '${lock}' \
|
||||||
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
timeout 240 '${lib.getExe pkgs.brightnessctl} -s set 10' \
|
||||||
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
resume '${lib.getExe pkgs.brightnessctl} -r' \
|
||||||
|
@ -52,10 +52,6 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
screenshot = lib.getExe' pkgs.shotman "shotman";
|
|
||||||
screenshot_screen = "${screenshot} --capture output";
|
|
||||||
screenshot_region = "${screenshot} --capture region";
|
|
||||||
|
|
||||||
cycleSwayDisplayModes = pkgs.writeShellScriptBin "cycleSwayDisplayModes" ''
|
cycleSwayDisplayModes = pkgs.writeShellScriptBin "cycleSwayDisplayModes" ''
|
||||||
# TODO: remove petalburg hardcodes
|
# TODO: remove petalburg hardcodes
|
||||||
current_mode=$(${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} -t get_outputs -p | grep "Current mode" | grep -Eo '[0-9]+x[0-9]+ @ [0-9.]+ Hz' | tr -d " " | grep 2880)
|
current_mode=$(${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} -t get_outputs -p | grep "Current mode" | grep -Eo '[0-9]+x[0-9]+ @ [0-9.]+ Hz' | tr -d " " | grep 2880)
|
||||||
|
@ -231,8 +227,8 @@
|
||||||
"XF86Launch3" = "exec ${lib.getExe cycleSwayDisplayModes}";
|
"XF86Launch3" = "exec ${lib.getExe cycleSwayDisplayModes}";
|
||||||
|
|
||||||
# Screenshots
|
# Screenshots
|
||||||
"PRINT" = "exec ${screenshot_screen}";
|
"PRINT" = "exec ${helpers.screenshot.screen}";
|
||||||
"${modifier}+PRINT" = "exec ${screenshot_region}";
|
"${modifier}+PRINT" = "exec ${helpers.screenshot.region}";
|
||||||
|
|
||||||
# Show/hide waybar
|
# Show/hide waybar
|
||||||
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
|
"${modifier}+F11" = "exec pkill -SIGUSR1 waybar";
|
||||||
|
@ -370,30 +366,16 @@
|
||||||
workspaceAutoBackAndForth = true;
|
workspaceAutoBackAndForth = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = let
|
extraConfig = ''
|
||||||
brightness = lib.getExe' pkgs.swayosd "swayosd-client";
|
bindsym --locked XF86MonBrightnessUp exec ${helpers.brightness.up}
|
||||||
brightness_up = "${brightness} --brightness=raise";
|
bindsym --locked XF86MonBrightnessDown exec ${helpers.brightness.down}
|
||||||
brightness_down = "${brightness} --brightness=lower";
|
bindsym --locked XF86AudioRaiseVolume exec ${helpers.volume.up}
|
||||||
volume = brightness;
|
bindsym --locked XF86AudioLowerVolume exec ${helpers.volume.down}
|
||||||
volume_up = "${volume} --output-volume=raise";
|
bindsym --locked XF86AudioMute exec ${helpers.volume.mute}
|
||||||
volume_down = "${volume} --output-volume=lower";
|
bindsym --locked XF86AudioMicMute exec ${helpers.mic.mute}
|
||||||
volume_mute = "${volume} --output-volume=mute-toggle";
|
bindsym --locked XF86AudioPlay exec ${helpers.media.play}
|
||||||
mic_mute = "${volume} --input-volume=mute-toggle";
|
bindsym --locked XF86AudioPrev exec ${helpers.media.prev}
|
||||||
media = lib.getExe pkgs.playerctl;
|
bindsym --locked XF86AudioNext exec ${helpers.media.next}
|
||||||
media_play = "${media} play-pause";
|
|
||||||
media_next = "${media} next";
|
|
||||||
media_prev = "${media} previous";
|
|
||||||
in ''
|
|
||||||
bindsym --locked XF86MonBrightnessUp exec ${brightness_up}
|
|
||||||
bindsym --locked XF86MonBrightnessDown exec ${brightness_down}
|
|
||||||
bindsym --locked XF86AudioRaiseVolume exec ${volume_up}
|
|
||||||
bindsym --locked XF86AudioLowerVolume exec ${volume_down}
|
|
||||||
bindsym --locked XF86AudioMute exec ${volume_mute}
|
|
||||||
bindsym --locked XF86AudioMicMute exec ${mic_mute}
|
|
||||||
bindsym --locked XF86AudioPlay exec ${media_play}
|
|
||||||
bindsym --locked XF86AudioPrev exec ${media_prev}
|
|
||||||
bindsym --locked XF86AudioNext exec ${media_next}
|
|
||||||
bindsym --locked XF86Launch2 exec ${media_play}
|
|
||||||
|
|
||||||
mode "move" {
|
mode "move" {
|
||||||
bindgesture swipe:right move container to workspace prev; workspace prev
|
bindgesture swipe:right move container to workspace prev; workspace prev
|
||||||
|
|
Loading…
Reference in a new issue