2024-06-02 16:25:58 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.services.sxhkd;
|
|
|
|
keybindingsStr = lib.concatStringsSep "\n" (lib.mapAttrsToList (hotkey: command:
|
|
|
|
lib.optionalString (command != null) ''
|
|
|
|
${hotkey}
|
|
|
|
${command}
|
|
|
|
'') cfg.keybindings);
|
|
|
|
in
|
2022-03-07 16:01:52 +01:00
|
|
|
{
|
|
|
|
services.sxhkd = {
|
2024-06-02 16:25:58 +02:00
|
|
|
enable = false;
|
2022-08-19 01:54:13 +02:00
|
|
|
keybindings = {
|
2022-03-07 16:01:52 +01:00
|
|
|
|
|
|
|
# make sxhkd reload its configuration files:
|
|
|
|
"super + Escape" = "pkill -USR1 -x sxhkd && ${pkgs.libnotify}/bin/notify-send -t 3000 \"sxhkd configuration reloaded\"";
|
|
|
|
|
|
|
|
# Applications
|
|
|
|
"super + s" = "$BROWSER";
|
|
|
|
|
|
|
|
"super + r" = "${pkgs.rofi}/bin/rofi -show drun";
|
|
|
|
|
|
|
|
# Volume
|
|
|
|
|
|
|
|
"super + {@F7,@F8}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}";
|
|
|
|
|
|
|
|
"{XF86AudioLowerVolume,XF86AudioRaiseVolume}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}";
|
|
|
|
|
|
|
|
"XF86AudioMute" = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
|
|
|
|
|
|
|
# Music
|
|
|
|
|
|
|
|
"super + p" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
|
|
|
|
|
|
|
"XF86AudioPlay" = "${pkgs.mpc_cli}/bin/mpc toggle";
|
|
|
|
"XF86AudioPrev" = "${pkgs.mpc_cli}/bin/mpc prev";
|
|
|
|
"XF86AudioNext" = "${pkgs.mpc_cli}/bin/mpc next";
|
|
|
|
|
|
|
|
# Monitor
|
|
|
|
|
|
|
|
"XF86MonBrightnessUp" = "${pkgs.light}/bin/light -A 5";
|
|
|
|
"XF86MonBrightnessDown" = "${pkgs.light}/bin/light -U 5";
|
|
|
|
|
|
|
|
"@Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard --select | ${pkgs.xclip}/bin/xclip -selection clipboard -target image/png -in";
|
|
|
|
|
|
|
|
"shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png";
|
|
|
|
|
|
|
|
# TODO: Add boomer as package
|
|
|
|
# "super + @Print" = "boomer";
|
|
|
|
|
|
|
|
# Misc
|
|
|
|
|
2024-06-08 12:42:12 +02:00
|
|
|
"super + l" = "loginctl lock-session";
|
|
|
|
|
2022-03-07 16:01:52 +01:00
|
|
|
"super + a" = "${pkgs.copyq}/bin/copyq toggle";
|
|
|
|
|
2024-06-02 16:25:58 +02:00
|
|
|
# fcitx "super + {b,n,m}" = "${pkgs.fcitx}/bin/fcitx-remote -s {mozc,fcitx-keyboard-no,fcitx-keyboard-us}";
|
2022-03-07 16:01:52 +01:00
|
|
|
|
|
|
|
# fcitx5
|
2022-11-20 18:32:03 +01:00
|
|
|
"super + {b,n,m}" = "${pkgs.fcitx5}/bin/fcitx5-remote -s {mozc,keyboard-no,keyboard-us}";
|
2022-03-07 16:01:52 +01:00
|
|
|
|
2022-08-19 01:54:13 +02:00
|
|
|
# TODO: fix
|
2022-03-07 16:01:52 +01:00
|
|
|
# "super + v" = "${pkgs.rofi}/bin/rofi -modi lpass:$HOME/.scripts/rofi/lpass/rofi-lpass -show lpass";
|
|
|
|
|
|
|
|
"super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter";
|
|
|
|
|
|
|
|
# ¯\_(ツ)_/¯
|
|
|
|
# "super + shift + s"
|
|
|
|
# sleep 0.3; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U00AF; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U005C; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U005F; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U0028; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U30C4; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U0029; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U005F; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U002F; \
|
|
|
|
# ${pkgs.xdotool}/bin/xdotool key U00AF
|
|
|
|
|
|
|
|
# é
|
|
|
|
"super + shift + e" = "sleep 0.3; ${pkgs.xdotool}/bin/xdotool key U00E9";
|
2022-08-19 01:54:13 +02:00
|
|
|
};
|
2022-03-07 16:01:52 +01:00
|
|
|
};
|
2024-06-02 16:25:58 +02:00
|
|
|
|
|
|
|
xdg.configFile."sxhkd/sxhkdrc".text =
|
|
|
|
lib.concatStringsSep "\n" [ keybindingsStr cfg.extraConfig ];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
systemd.user.services.sxhkd = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Simple X hotkey daemon";
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
After = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart = "${cfg.package}/bin/sxhkd ${toString cfg.extraOptions}";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
|
|
};
|
2022-03-07 16:01:52 +01:00
|
|
|
}
|