ZH5LGJE4YAOHG5UP6P4X3NPIUROJWHEXR3PX56PATR5KNIMQL35QC
VMKJ4UOWNB2QFRPYKWNOOVY6PU7QH6A6EFEKDLWRU3VIQIEHI7QAC
2MH4TU2HSSXKDWLUQXEBJER4F52ALDFAKVUVNT5O4XSFZHPYV53QC
PS2VFJMZVN77RHZFVUVD2DA3MZNMXYPHT6XRHW2EUTZRGLAXF4YQC
NJ5ENURMCBSNFQPNXXNUBMUXVJEBIGNH2T7EWGB63F3FV723BUWAC
TXU55BEHKBJLAFQATXNK36M3CM2KNH3YCQCVF54NK7O2CO4LHM4QC
INKINKWN6MRRH4CGUVTWI5TQ7VSCHA6ODXMLHVVFCHYPM27AYNNQC
7BNKOFCPOMGW4OEIPGZJF76J4CTD65TZ7CLJPKJOWOIJ65EDVWEQC
CL7RP3ZICLJT7YUI3O54IB2GZY7QMKK7ZC6GZPDXFYQKOOM64CHQC
WDE4LLYP24YKDAV6PW62DFNWV3WZWQUUPA7CZH6STDZFYU7ARERQC
compose = {
"t" = ''exec swaymsg [app_id="scratch_terminal"] scratchpad show; mode default;'';
"f" = "fullscreen toggle; mode default;";
"Insert" = "mode default";
"Escape" = "mode default";
"Return" = "mode default";
disabled_mode = {
# a mode for ignoring all keybindings until the compose mode keys are
# repeated.
"Shift+space" = "mode default";
resize = {
"h" = "resize shrink width 15 px";
"j" = "resize grow height 15 px";
"k" = "resize shrink height 15 px";
"l" = "resize grow width 15 px";
"Escape" = "mode default";
"Return" = "mode default";
};
compose_mode = {
# a mode for entering other modes, or inserting commands based on
# sequential key presses
# e.g. Shift+space -> k -> s == bemenu_try_restart_systemd_user_services
f = "fullscreen toggle; mode default;";
k = "mode kill_mode";
r = "mode resize_mode";
t = ''exec swaymsg [app_id="scratch_terminal"] scratchpad show; mode default;'';
v = "mode volume_mode";
"Shift+space" = "mode disabled_mode";
} // leaveModeKeys;
kill_mode = {
q = "exec swaymsg exit";
r = "exec systemctl reboot -i";
s = "exec bemenu_try_restart_systemd_user_services; mode default;";
w = "kill; mode default;";
} // leaveModeKeys;
resize_mode = {
"${cfg.up}" = "resize shrink width 15 px";
"${cfg.down}" = "resize grow height 15 px";
"${cfg.left}" = "resize shrink height 15 px";
"${cfg.right}" = "resize grow width 15 px";
"Shift+${cfg.up}" = "resize shrink width 45 px";
"Shift+${cfg.down}" = "resize grow height 45 px";
"Shift+${cfg.left}" = "resize shrink height 45 px";
"Shift+${cfg.right}" = "resize grow width 45 px";
} // leaveModeKeys;
volume_mode = {
"${cfg.up}" = "${setVolume} +1%";
"Shift+${cfg.up}" = "${setVolume} +10%";
"${cfg.down}" = "${setVolume} -1%";
"Shift+${cfg.down}" = "${setVolume} -10%";
} // leaveModeKeys;
workspace_mode = {
"0" = "workspace 0";
"1" = "workspace 1";
"2" = "workspace 2";
"3" = "workspace 3";
"4" = "workspace 4";
"5" = "workspace 5";
"6" = "workspace 6";
"7" = "workspace 7";
"8" = "workspace 8";
"9" = "workspace 9";
"${cfg.right}" = "workspace next";
"${cfg.left}" = "workspace prev";
} // leaveModeKeys;
"XF86LaunchB" = "exec ${nwg-drawer}/bin/nwg-drawer";
"XF86AudioPlay" = "exec ${playerctl} play-pause";
"XF86AudioNext" = "exec ${playerctl} next";
"XF86AudioPrev" = "exec ${playerctl} previous";
"XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume $(${pactl} list short sinks | grep RUNNING | cut -f 1) -5%";
"XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume $(${pactl} list short sinks | grep RUNNING | cut -f 1) +5%";
"XF86AudioMute" = "exec ${pactl} set-sink-volume $(${pactl} list short sinks | grep RUNNING | cut -f 1) 0%";
"XF86MonBrightnessDown" = "exec ${brightnessctl} set 5%-";
"XF86MonBrightnessUp" = "exec ${brightnessctl} set +5%";
XF86LaunchB = "exec ${nwg-drawer}/bin/nwg-drawer";
XF86AudioPlay = "exec ${playerctl} play-pause";
XF86AudioNext = "exec ${playerctl} next";
XF86AudioPrev = "exec ${playerctl} previous";
XF86AudioLowerVolume = "${setVolume} -5%";
XF86AudioRaiseVolume = "${setVolume} +5%";
XF86AudioMute = "${setVolume} 0%";
XF86MonBrightnessDown = "exec ${brightnessctl} set 5%-";
XF86MonBrightnessUp = "exec ${brightnessctl} set +5%";
"${modkey}+ctrl+l" = "workspace next";
"${modkey}+ctrl+h" = "workspace prev";
"${modkey}+ctrl+j" = "workspace back_and_forth";
"${modkey}+ctrl+k" = "workspace back_and_forth";
"${modkey}+ctrl+${cfg.right}" = "workspace next";
"${modkey}+ctrl+${cfg.left}" = "workspace prev";
"${modkey}+ctrl+${cfg.down}" = "workspace back_and_forth";
"${modkey}+ctrl+${cfg.up}" = "workspace back_and_forth";
list_systemd_services = writeShellApplication rec {
name = "list_systemd_services";
runtimeInputs = [ bemenu fzf gawk ];
text = ''
USER_OR_SYSTEM="user"
FUZZY_FINDER="fzf --multi --exact --reverse --tiebreak=index"
function echo_help () {
echo "Usage: $0 [options]"
echo Options:
echo " -h, --help show this message"
echo " --user passed to systemctl e.g. systemctl --user"
echo " --system passed to systemctl e.g. systemctl --system"
echo " --fuzzy-finder give an alternative fuzzy finder command"
echo " defaults to: $FUZZY_FINDER"
echo " bemenu is also supported. e.g."
echo " ${name} --fuzzy-finder bemenu --ignorecase --center --margin 10 --list 10"
}
while [ $# -gt 0 ] && [ -n "$1" ]; do
case "$1" in
--help|-h)
echo_help
;;
--user|--system)
USER_OR_SYSTEM="$1"
;;
--fuzzy-finder)
shift
FUZZY_FINDER="$*"
break
;;
*)
echo_help
;;
esac
if [ $# -gt 0 ]; then
shift
fi
done
systemctl "--$USER_OR_SYSTEM" list-unit-files --type=service --no-legend \
| eval -- "$FUZZY_FINDER" \
| awk '{print $1}'
'';
};
bemenu_list_systemd_services = writeShellApplication {
name = "bemenu_list_systemd_services";
runtimeInputs = [ list_systemd_services ];
text = "list_systemd_services --fuzzy-finder bemenu --ignorecase --center --margin 10 --list 10";
};
try_restart_systemd_user_services = writeShellApplication {
name = "try_restart_systemd_user_services";
runtimeInputs = [ list_systemd_services ];
text = ''
CHOICES="$(list_systemd_services "$@")"
if [ -n "$CHOICES" ]; then
systemctl --user try-restart "$CHOICES"
fi
'';
};
bemenu_try_restart_systemd_user_services = writeShellApplication {
name = "bemenu_try_restart_systemd_user_services";
runtimeInputs = [ try_restart_systemd_user_services ];
text = "try_restart_systemd_user_services --fuzzy-finder bemenu --ignorecase --center --margin 10 --list 10";
};