mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
moved systems to their own folders
reworked sxhkd moved images to /misc
This commit is contained in:
parent
9d887fc79c
commit
32bf78aa36
13 changed files with 66 additions and 100 deletions
|
|
@ -6,61 +6,56 @@ _: {
|
|||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.sxhkd;
|
||||
keybindingsStr = concatStringsSep "\n" (mapAttrsToList (hotkey: command:
|
||||
optionalString (command != null) ''
|
||||
${hotkey}
|
||||
${command}
|
||||
'')
|
||||
cfg.keybindings);
|
||||
configFile = pkgs.writeText "sxhkdrc" (concatStringsSep "\n" [keybindingsStr cfg.extraConfig]);
|
||||
cfg = config.localModules.sxhkd;
|
||||
keybindingsStr = ''
|
||||
XF86AudioPlay
|
||||
playerctl play-pause
|
||||
XF86AudioPause
|
||||
playerctl play-pause
|
||||
XF86AudioStop
|
||||
playerctl stop
|
||||
XF86AudioNext
|
||||
playerctl next
|
||||
XF86AudioPrev
|
||||
playerctl previous
|
||||
XF86AudioRaiseVolume
|
||||
amixer sset Master 40+
|
||||
XF86AudioLowerVolume
|
||||
amixer sset Master 40-
|
||||
XF86AudioMute
|
||||
amixer sset Master toggle
|
||||
XF86MonBrightnessUp
|
||||
brightnessctl s 20+
|
||||
XF86MonBrightnessDown
|
||||
brightnessctl s 20-
|
||||
Print
|
||||
maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
|
||||
Print + shift
|
||||
maim | xclip -selection clipboard -t image/png
|
||||
super + Print
|
||||
maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
|
||||
super + Print + shift
|
||||
maim -s | xclip -selection clipboard -t image/png
|
||||
'';
|
||||
configFile = pkgs.writeText "sxhkdrc" keybindingsStr;
|
||||
in {
|
||||
options.services.sxhkd = {
|
||||
options.localModules.sxhkd = {
|
||||
enable = mkEnableOption "simple X hotkey daemon";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sxhkd;
|
||||
defaultText = "pkgs.sxhkd";
|
||||
description = "Package containing the <command>sxhkd</command> executable.";
|
||||
};
|
||||
extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "Command line arguments to invoke <command>sxhkd</command> with.";
|
||||
example = literalExpression ''[ "-m 1" ]'';
|
||||
};
|
||||
|
||||
keybindings = mkOption {
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
default = {};
|
||||
description = "An attribute set that assigns hotkeys to commands.";
|
||||
example = literalExpression ''
|
||||
{
|
||||
"super + shift + {r,c}" = "i3-msg {restart,reload}";
|
||||
"super + {s,w}" = "i3-msg {stacking,tabbed}";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
description = "Additional configuration to add.";
|
||||
example = literalExpression ''
|
||||
super + {_,shift +} {1-9,0}
|
||||
i3-msg {workspace,move container to workspace} {1-10}
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [cfg.package];
|
||||
environment.systemPackages = [
|
||||
pkgs.maim #screenshooter
|
||||
pkgs.brightnessctl #brightness control for laptop
|
||||
pkgs.playerctl #music control
|
||||
pkgs.xclip
|
||||
pkgs.coreutils
|
||||
];
|
||||
systemd.user.services.sxhkd = {
|
||||
description = "sxhkd hotkey daemon";
|
||||
wantedBy = ["graphical-session.target"];
|
||||
partOf = ["graphical-session.target"];
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/sxhkd -c ${configFile} ${toString cfg.extraOptions}";
|
||||
ExecStart = "${pkgs.sxhkd}/bin/sxhkd -c ${configFile}";
|
||||
RestartSec = 3;
|
||||
Restart = "always";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue