istg i have to make smaller commits
This commit is contained in:
parent
1ed9ce6864
commit
29473532c7
28 changed files with 483 additions and 361 deletions
|
@ -42,7 +42,23 @@
|
|||
mod = config.wayland.windowManager.sway.config.modifier;
|
||||
wobVolume = "${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_SINK@ | awk '{print $2*100}' > $XDG_RUNTIME_DIR/wob.sock";
|
||||
setVolume = limit: amount: "${pkgs.wireplumber}/bin/wpctl set-volume -l ${limit} @DEFAULT_AUDIO_SINK@ ${amount}";
|
||||
perMonitor = workspace: "\"$(swaymsg -t get_outputs | ${lib.getExe pkgs.jq} -r '.[] | select(.focused == true).name' | ${lib.getExe pkgs.perl} -ne '$s=0;for(split//){$s+=ord}print\"$s\"')${toString workspace}\"";
|
||||
#perMonitor = workspace: "\"$(swaymsg -t get_outputs | ${lib.getExe pkgs.jq} -r '.[] | select(.focused == true).name' | ${lib.getExe pkgs.perl} -ne '$s=0;for(split//){$s+=ord}print\"$s\"')${toString workspace}\"";
|
||||
monitorId = pkgs.writers.writeBash "monitor-id" ''
|
||||
swaymsg -t get_outputs \
|
||||
| ${lib.getExe pkgs.jq} -r '.[] | select (.focused == true).name' \
|
||||
| ${lib.getExe pkgs.perl} -ne '$s=0;for(split//){$s+=ord}print"$s"'
|
||||
'';
|
||||
pauseApp = pkgs.writers.writeBash "pause-app" ''
|
||||
set -e
|
||||
pid=$(swaymsg -t get_tree \
|
||||
| ${lib.getExe pkgs.jq} -re '.. | select (.type? == "con" and .focused? == true).pid')
|
||||
|
||||
if [ $(cat "/proc/$pid/wchan") == "do_signal_stop" ]; then
|
||||
kill -s SIGCONT $pid
|
||||
else
|
||||
kill -s SIGSTOP $pid
|
||||
fi
|
||||
'';
|
||||
dir = with config.wayland.windowManager.sway.config; {
|
||||
inherit up down left right;
|
||||
};
|
||||
|
@ -61,7 +77,10 @@
|
|||
"${mod}+Ctrl+Shift+${dir.down}" = "move output down";
|
||||
|
||||
"${mod}+Shift+Backspace" = "exec systemctl suspend";
|
||||
"${mod}+Shift+s" = "exec ${lib.getExe pkgs.grimblast} copy area";
|
||||
"${mod}+Shift+s" = "exec ${lib.getExe pkgs.sway-contrib.grimshot} copy anything";
|
||||
"${mod}+Ctrl+Shift+s" = "exec XDG_PICTURES_DIR=$XDG_PICTURES_DIR/screenshots ${lib.getExe pkgs.sway-contrib.grimshot} savecopy anything";
|
||||
|
||||
"${mod}+Shift+p" = "exec ${pauseApp}";
|
||||
|
||||
"XF86AudioRaiseVolume" = "exec ${setVolume "1.5" "3%+"} && ${wobVolume}";
|
||||
"XF86AudioLowerVolume" = "exec ${setVolume "1.5" "3%-"} && ${wobVolume}";
|
||||
|
@ -70,19 +89,20 @@
|
|||
"XF86AudioNext" = "exec ${lib.getExe pkgs.playerctl} next";
|
||||
"XF86AudioPrev" = "exec ${lib.getExe pkgs.playerctl} previous";
|
||||
}
|
||||
// builtins.listToAttrs (lib.flatten
|
||||
(builtins.map (x: let
|
||||
x' = toString x;
|
||||
in [
|
||||
{
|
||||
name = "${mod}+${x'}";
|
||||
value = "exec swaymsg workspace number ${perMonitor x'}:${x'}";
|
||||
}
|
||||
{
|
||||
name = "${mod}+Shift+${toString x'}";
|
||||
value = "exec swaymsg move container to workspace number ${perMonitor x'}:${x'}";
|
||||
}
|
||||
]) (lib.range 0 9)))
|
||||
// (let
|
||||
inherit (builtins) foldl';
|
||||
inherit (lib) range;
|
||||
in
|
||||
foldl' (acc: x:
|
||||
acc
|
||||
// (let
|
||||
y = toString x;
|
||||
in {
|
||||
"${mod}+${y}" = "exec swaymsg workspace number \"$(${monitorId})${y}:${y}\"";
|
||||
"${mod}+Shift+${y}" = "exec swaymsg move container to workspace number \"$(${monitorId})${y}:${y}\"";
|
||||
}))
|
||||
{}
|
||||
(range 0 9))
|
||||
);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue