mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-12 23:42:56 +00:00
partial success of i3 and sxhkd
This commit is contained in:
parent
97c94e6b6a
commit
6ea3da93db
@ -13,7 +13,7 @@
|
||||
"$cmd_duration"
|
||||
"$character"
|
||||
];
|
||||
right_format = "$nix_shell";
|
||||
# right_format = "$nix_shell";
|
||||
character = {
|
||||
success_symbol = "[❯](bold green)";
|
||||
error_symbol = "[❯](bold red)";
|
||||
|
@ -5,6 +5,7 @@
|
||||
./fonts.nix
|
||||
./gtk.nix
|
||||
./i3.nix
|
||||
./keybinds.nix
|
||||
./picom.nix
|
||||
./polybar.nix
|
||||
./rofi.nix
|
||||
|
@ -15,7 +15,7 @@ let
|
||||
"7" = "7:VII";
|
||||
"8" = "8:VIII";
|
||||
"9" = "9:IX";
|
||||
"0" = "10:X";
|
||||
"10" = "10:X";
|
||||
};
|
||||
|
||||
in {
|
||||
@ -124,30 +124,18 @@ in {
|
||||
extraConfig = "";
|
||||
};
|
||||
|
||||
programs.sxhkd.keybindings = let
|
||||
services.sxhkd.keybindings = let
|
||||
|
||||
# Shortcuts
|
||||
binds =
|
||||
config.home-manager.users.${config.user}.programs.sxhkd.keybindings;
|
||||
i3-msg = "${pkgs.i3}/bin/i3-msg";
|
||||
|
||||
# Create an attrset of keybinds to actions for every workspace by number
|
||||
bindAll = let workspaceNums = builtins.attrNames workspaces;
|
||||
in keybindFunction: actionFunction:
|
||||
# 1 -> "keybind + 1" -> "some action on ws 1"
|
||||
lib.genAttrs (map keybindFunction workspaceNums) actionFunction;
|
||||
|
||||
# Look up the name of the workspace based on its number
|
||||
lookup = num: builtins.getAttr num workspaces;
|
||||
|
||||
in {
|
||||
|
||||
# Window navigation
|
||||
"super + {h,j,k,l}" = ''${i3-msg} "focus {left,down,up,right}"'';
|
||||
"super + {Left,Down,Up,Right}" = binds."super + {h,j,k,l}";
|
||||
"super + shift + {h,j,k,l}" = ''${i3-msg} "move {left,down,up,right}"'';
|
||||
"super + shift + {Left,Down,Up,Right}" =
|
||||
binds."super + shift + {h,j,k,l}";
|
||||
"super + {_,shift +}{h,j,k,l}" =
|
||||
''${i3-msg} "{focus,move} {left,down,up,right}"'';
|
||||
"super + {_,shift +}{Left,Down,Up,Right}" =
|
||||
''${i3-msg} "{focus,move} {left,down,up,right}"'';
|
||||
"super + q" = ''${i3-msg} "kill"'';
|
||||
"super + f" = ''${i3-msg} "fullscreen toggle"'';
|
||||
|
||||
@ -166,21 +154,17 @@ in {
|
||||
# Restart and reload
|
||||
"super + shift + {c,r}" = ''${i3-msg} "{reload,restart}"'';
|
||||
|
||||
}
|
||||
"super + {1-9,0}" = ''${i3-msg} "workspace {1-9,10}"'';
|
||||
"super + shift + {1-9,0}" = ''
|
||||
WORKSPACE={1-9,10};
|
||||
${i3-msg} "move container to workspace $WORKSPACE; workspace $WORKSPACE"'';
|
||||
|
||||
# Bind super + workspace -> switch to workspace
|
||||
// (bindAll (num: "super + ${num}")
|
||||
(num: ''${i3-msg} "workspace ${lookup num}"''))
|
||||
"super + r : {h,j,k,l}" =
|
||||
''${i3-msg} "resize {shrink,grow} width 10px or 10 ppt"'';
|
||||
"super + r : {j,k}" =
|
||||
''${i3-msg} "resize {shrink,grow} height 10px or 10 ppt"'';
|
||||
|
||||
# Bind super + shift + workspace -> move to workspace
|
||||
// (bindAll (num: "super + shift + ${num}") (num:
|
||||
''
|
||||
${i3-msg} "move container to workspace ${lookup num}; workspace ${
|
||||
lookup num
|
||||
}"''));
|
||||
|
||||
lockScreenCommand =
|
||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||
};
|
||||
|
||||
programs.fish.functions = {
|
||||
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
||||
@ -202,6 +186,9 @@ in {
|
||||
|
||||
};
|
||||
|
||||
lockScreenCommand =
|
||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||
|
||||
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
||||
systemd.services.lock = {
|
||||
enable = config.services.xserver.enable;
|
||||
|
@ -1,45 +1,52 @@
|
||||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, ... }: {
|
||||
|
||||
let
|
||||
home-manager.users.${config.user} = {
|
||||
services.sxhkd = {
|
||||
enable = true;
|
||||
keybindings = {
|
||||
|
||||
binds = config.home-manager.users.${config.user}.programs.sxhkd.keybindings;
|
||||
# Adjust screen brightness (TODO: replace with pkgs.light?)
|
||||
"shift + {F11,F12}" = ''
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
|
||||
'';
|
||||
"XF86MonBrightness{Down,Up}" = ''
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
|
||||
'';
|
||||
|
||||
in {
|
||||
# Media controls
|
||||
"XF86Audio{Play,Stop,Next,Prev}" =
|
||||
"${pkgs.playerctl}/bin/playerctl {play-pause,stop,next,previous}";
|
||||
|
||||
home-manager.users.${config.user}.programs.sxhkd = {
|
||||
enable = true;
|
||||
keybindings = {
|
||||
# Toggle bar
|
||||
"super + b" = config.toggleBarCommand;
|
||||
|
||||
# Adjust screen brightness (TODO: replace with pkgs.light?)
|
||||
"shift + {F11,F12}" = ''
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
|
||||
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
|
||||
'';
|
||||
"XF86MonBrightness{Down,Up}" = binds."shift + {F11,F12}";
|
||||
|
||||
# Media controls
|
||||
"XF86Audio{Play,Stop,Next,Prev}" =
|
||||
"${pkgs.playerctl}/bin/playerctl {play-pause,stop,next,previous}";
|
||||
|
||||
# Toggle bar
|
||||
"super + b" = config.toggleBarCommand;
|
||||
|
||||
# Launchers
|
||||
"super + Return" = config.terminal;
|
||||
"super + space" = config.launcherCommand;
|
||||
"super + shift + s" = config.systemdSearch;
|
||||
"super + shift + a" = config.audioSwitchCommand;
|
||||
"alt + Tab" = config.altTabCommand;
|
||||
"super + shift + period" = config.powerCommand;
|
||||
"super + shift + m" = config.brightnessCommand;
|
||||
"super + c" = config.calculatorCommand;
|
||||
"super + shift + x" = config.lockScreenCommand;
|
||||
"super + alt + h" =
|
||||
"${config.terminal} sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||
"super + alt + r" =
|
||||
"${config.terminal} sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||
# Launchers
|
||||
"super + Return" = config.terminal;
|
||||
"super + space" = config.launcherCommand;
|
||||
"super + shift + s" = config.systemdSearch;
|
||||
"super + shift + a" = config.audioSwitchCommand;
|
||||
"alt + Tab" = config.altTabCommand;
|
||||
"super + shift + period" = config.powerCommand;
|
||||
"super + shift + m" = config.brightnessCommand;
|
||||
"super + c" = config.calculatorCommand;
|
||||
"super + shift + x" = config.lockScreenCommand;
|
||||
"super + alt + h" =
|
||||
"${config.terminal} sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||
"super + alt + r" =
|
||||
"${config.terminal} sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
xsession.windowManager.i3.config.startup = [{
|
||||
|
||||
command = "pkill sxhkd; sxhkd";
|
||||
always = true;
|
||||
notification = false;
|
||||
}];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user