aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/desktop/default.nix2
-rw-r--r--modules/desktop/sxhkd/default.nix39
-rw-r--r--modules/desktop/sxhkd/keybindings/brightnessctl.nix14
-rw-r--r--modules/desktop/sxhkd/keybindings/bspwm.nix36
-rw-r--r--modules/desktop/sxhkd/keybindings/maim.nix18
-rw-r--r--modules/desktop/sxhkd/keybindings/pamixer.nix16
-rw-r--r--modules/desktop/sxhkd/keybindings/playerctl.nix12
-rwxr-xr-xmodules/desktop/sxhkd/scripts/keybindings.sh76
-rw-r--r--modules/desktop/xremap/default.nix29
-rw-r--r--modules/desktop/xremap/keybindings/brightnessctl.nix18
-rw-r--r--modules/desktop/xremap/keybindings/bspwm.nix273
-rw-r--r--modules/desktop/xremap/keybindings/kitty.nix30
-rw-r--r--modules/desktop/xremap/keybindings/maim.nix19
-rw-r--r--modules/desktop/xremap/keybindings/pamixer.nix26
-rw-r--r--modules/desktop/xremap/keybindings/playerctl.nix12
-rw-r--r--modules/desktop/xremap/keybindings/rofi.nix12
-rw-r--r--modules/tools/kitty/default.nix9
-rw-r--r--modules/tools/nixvim/default.nix8
18 files changed, 431 insertions, 218 deletions
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix
index 2856d45..74efff8 100644
--- a/modules/desktop/default.nix
+++ b/modules/desktop/default.nix
@@ -10,7 +10,7 @@
./bspwm
./gtk
./polybar
- ./sxhkd
+ ./xremap
];
options.desktop = {
diff --git a/modules/desktop/sxhkd/default.nix b/modules/desktop/sxhkd/default.nix
deleted file mode 100644
index fe8acbb..0000000
--- a/modules/desktop/sxhkd/default.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- pkgs,
- config,
- lib,
- ...
-}:
-
-{
- config = lib.mkIf config.desktop.enable {
- services.sxhkd.enable = true;
- services.sxhkd.keybindings =
- let
- modKey = "super";
- createKeybinding = keybinding: createKeybindingBase "${modKey} + ${keybinding}";
- createKeybindingBase = keybinding: description: command: {
- "# ${description}\n${keybinding}" = command;
- };
- in
- lib.mkMerge [
- (import ./keybindings/brightnessctl.nix { inherit pkgs createKeybindingBase lib; })
- (import ./keybindings/bspwm.nix { inherit pkgs createKeybinding lib; })
- (import ./keybindings/maim.nix { inherit pkgs createKeybinding lib; })
- (import ./keybindings/pamixer.nix { inherit pkgs createKeybindingBase lib; })
- (import ./keybindings/playerctl.nix { inherit pkgs createKeybindingBase lib; })
-
- (createKeybinding "s" "Show keybindings."
- "kitty --title 'Keybindings' --class floating-termial -e ${pkgs.writeShellScript "keybindings.sh" (builtins.readFile ./scripts/keybindings.sh)}"
- )
-
- (createKeybinding "r" "Application launcher." "rofi -show drun")
-
- (createKeybinding "t" "Launch terminal." "kitty")
-
- (createKeybinding "f" "Launch File Manager."
- "kitty --title 'File Manager' --class floating-termial -e nnn"
- )
- ];
- };
-}
diff --git a/modules/desktop/sxhkd/keybindings/brightnessctl.nix b/modules/desktop/sxhkd/keybindings/brightnessctl.nix
deleted file mode 100644
index c48c86b..0000000
--- a/modules/desktop/sxhkd/keybindings/brightnessctl.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- createKeybindingBase,
- pkgs,
- lib,
-}:
-
-let
- brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
-in
-lib.mkMerge [
- (createKeybindingBase "XF86MonBrightnessDown" "Decrease brightness." "${brightnessctl} set 5%-")
-
- (createKeybindingBase "XF86MonBrightnessUp" "Increase brightness." "${brightnessctl} set +5%")
-]
diff --git a/modules/desktop/sxhkd/keybindings/bspwm.nix b/modules/desktop/sxhkd/keybindings/bspwm.nix
deleted file mode 100644
index 097b976..0000000
--- a/modules/desktop/sxhkd/keybindings/bspwm.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- createKeybinding,
- pkgs,
- lib,
-}:
-
-let
- bspc = "${pkgs.bspwm}/bin/bspc";
-in
-lib.mkMerge [
- (createKeybinding "q" "Kill current window." "${bspc} node -c")
-
- (createKeybinding "{1-9,0}" "Switch workspace." "${bspc} desktop -f {1-9,10}")
-
- (createKeybinding "shift + {1-9,0}" "Move window to workspace." "${bspc} node -d {1-9,10} --follow")
-
- (createKeybinding "{n,d,m}" "Set current window mode (tiled, floating, fullscreen)."
- "${bspc} node focused -t {tiled,floating,fullscreen}"
- )
-
- (createKeybinding "{_,shift + }{h,j,k,l}" "Navigate between windows."
- "${bspc} node --{focus,swap} {west,south,north,east}"
- )
-
- # the indentation for each line is required to work with the help prompt
- (createKeybinding "ctrl + {h,j,k,l}" "Resize current window." ''
- ${bspc} node {@parent/second -z left -20 0; \
- @parent/first -z right -20 0, \
- @parent/second -z top 0 +20; \
- @parent/first -z bottom 0 +20, \
- @parent/first -z bottom 0 -20; \
- @parent/second -z top 0 -20, \
- @parent/first -z right +20 0; \
- @parent/second -z left +20 0}
- '')
-]
diff --git a/modules/desktop/sxhkd/keybindings/maim.nix b/modules/desktop/sxhkd/keybindings/maim.nix
deleted file mode 100644
index 0f0b3d8..0000000
--- a/modules/desktop/sxhkd/keybindings/maim.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- createKeybinding,
- pkgs,
- lib,
-}:
-
-let
- maim = "${pkgs.maim}/bin/maim";
-in
-lib.mkMerge [
- (createKeybinding "p" "Take screenshot of selected area and save to clipboard"
- "${maim} -s | xclip -selection clipboard -t image/png"
- )
-
- (createKeybinding "shift + p" "Take screenshot of selected area and save to ~/Pictures/Screenshots"
- "mkdir -p ~/Pictures/Screenshots && ${maim} -s ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png"
- )
-]
diff --git a/modules/desktop/sxhkd/keybindings/pamixer.nix b/modules/desktop/sxhkd/keybindings/pamixer.nix
deleted file mode 100644
index 4b495aa..0000000
--- a/modules/desktop/sxhkd/keybindings/pamixer.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- createKeybindingBase,
- pkgs,
- lib,
-}:
-
-let
- pamixer = "${pkgs.pamixer}/bin/pamixer";
-in
-lib.mkMerge [
- (createKeybindingBase "XF86AudioLowerVolume" "Decrease volume." "${pamixer} --decrease 5")
-
- (createKeybindingBase "XF86AudioRaiseVolume" "Increase volume." "${pamixer} --increase 5")
-
- (createKeybindingBase "XF86AudioMute" "Mute audio." "${pamixer} --toggle-mute")
-]
diff --git a/modules/desktop/sxhkd/keybindings/playerctl.nix b/modules/desktop/sxhkd/keybindings/playerctl.nix
deleted file mode 100644
index e9d744e..0000000
--- a/modules/desktop/sxhkd/keybindings/playerctl.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- createKeybindingBase,
- pkgs,
- lib,
-}:
-
-let
- playerctl = "${pkgs.playerctl}/bin/playerctl";
-in
-lib.mkMerge [
- (createKeybindingBase "XF86AudioPlay" "Toggle video / audio player." "${playerctl} play-pause")
-]
diff --git a/modules/desktop/sxhkd/scripts/keybindings.sh b/modules/desktop/sxhkd/scripts/keybindings.sh
deleted file mode 100755
index e713415..0000000
--- a/modules/desktop/sxhkd/scripts/keybindings.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-# Path to your sxhkd config file
-SXHKD_FILE="$HOME/.config/sxhkd/sxhkdrc"
-
-# Function to wrap text to a specified width
-wrap_text() {
- local text="$1"
- local width="$2"
- echo "$text" | fold -s -w "$width"
-}
-
-# Get terminal width
-terminal_width=$(tput cols)
-
-# Set the table width to the full terminal width, leaving space for borders
-table_width=$((terminal_width - 4)) # 4 for the borders and space between columns
-
-# Set keybinding column width to half of the available width
-max_keybinding_length=$((table_width / 2))
-
-# Length of the cotent inside the cell (2 spaces are substracted for padding)
-max_keybinding_content_length=$((max_keybinding_length - 2))
-
-# Set the description column width to the other half
-description_width=$((table_width - max_keybinding_length - 1)) # 1 for the separator between columns
-
-# Length of the cotent inside the cell (2 spaces are substracted for padding)
-description_content_width=$((description_width - 2))
-
-# Generate the top border line and row separator
-border_line="├$(printf '%.0s─' $(seq 1 $max_keybinding_length))┼$(printf '%.0s─' $(seq 1 $description_width))┤"
-
-# Pipe all output to less
-{
- # Print table header with borders
- echo "┌$(printf '%.0s─' $(seq 1 $max_keybinding_length))┬$(printf '%.0s─' $(seq 1 $description_width))┐"
- printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "KEYBINDING" "$description_content_width" "DESCRIPTION"
-
- description=""
-
- # Load the sxhkd file into an array
- mapfile -t lines < "$SXHKD_FILE"
-
- # Loop through lines for output
- for line in "${lines[@]}"; do
- # Check if the line is a comment
- if [[ $line =~ ^# ]]; then
- # Remove the "#" and any leading/trailing whitespace to capture the description
- description="${line#\# }"
- elif [[ $line =~ ^[^#[:space:]] ]]; then
- # If it's a keybinding line, store it
- keybinding="$line"
- # Move to the next line for the command
- command="${lines[((++i))]}"
-
- # Wrap the description to the calculated width
- wrapped_description=$(wrap_text "$description" "$description_width")
-
- # Print the keybinding with a border line above and below it
- echo "$border_line"
- printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "$keybinding" "$description_content_width" "$(echo "$wrapped_description" | head -n 1)"
-
- # Print wrapped description lines with empty keybinding column
- echo "$wrapped_description" | sed '1d' | while read -r continuation; do
- printf "│ %-*s │ %-*s │\n" "$max_keybinding_content_length" "" "$description_content_width" "$continuation"
- done
-
- # Reset description for the next keybinding
- description=""
- fi
- done
-
- # Print the final border line
- echo "└$(printf '%.0s─' $(seq 1 $max_keybinding_length))┴$(printf '%.0s─' $(seq 1 $description_width))┘"
-} | less
diff --git a/modules/desktop/xremap/default.nix b/modules/desktop/xremap/default.nix
new file mode 100644
index 0000000..82976d0
--- /dev/null
+++ b/modules/desktop/xremap/default.nix
@@ -0,0 +1,29 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+
+{
+ config = lib.mkIf config.desktop.enable {
+ services.xremap = {
+ enable = true;
+ withX11 = true;
+ config.keymap = [
+ {
+ name = "Global Shortcuts";
+ remap = lib.mkMerge [
+ # (import ./keybindings/brightnessctl.nix { inherit pkgs; })
+ (import ./keybindings/bspwm.nix { inherit pkgs; })
+ (import ./keybindings/kitty.nix { inherit pkgs; })
+ (import ./keybindings/maim.nix { inherit pkgs; })
+ # (import ./keybindings/pamixer.nix { inherit pkgs; })
+ # (import ./keybindings/playerctl.nix { inherit pkgs; })
+ (import ./keybindings/rofi.nix { inherit pkgs; })
+ ];
+ }
+ ];
+ };
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/brightnessctl.nix b/modules/desktop/xremap/keybindings/brightnessctl.nix
new file mode 100644
index 0000000..b2f39cb
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/brightnessctl.nix
@@ -0,0 +1,18 @@
+{ pkgs }:
+
+{
+ "XF86MonBrightnessDown" = {
+ launch = [
+ "${pkgs.brightnessctl}/bin/brightnessctl"
+ "set"
+ "5%-"
+ ];
+ };
+ "XF86MonBrightnessUp" = {
+ launch = [
+ "${pkgs.brightnessctl}/bin/brightnessctl"
+ "set"
+ "+5%"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/bspwm.nix b/modules/desktop/xremap/keybindings/bspwm.nix
new file mode 100644
index 0000000..1d4a347
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/bspwm.nix
@@ -0,0 +1,273 @@
+{ pkgs }:
+
+{
+
+ "super-q" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-c"
+ ];
+ };
+
+ # Window States
+ "super-n" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "focused"
+ "-t"
+ "tiled"
+ ];
+ };
+ "super-d" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "focused"
+ "-t"
+ "floating"
+ ];
+ };
+ "super-m" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "focused"
+ "-t"
+ "fullscreen"
+ ];
+ };
+
+ # Navigation (Manual expansion of {h,j,k,l})
+ "super-h" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-f"
+ "west"
+ ];
+ };
+ "super-j" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-f"
+ "south"
+ ];
+ };
+ "super-k" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-f"
+ "north"
+ ];
+ };
+ "super-l" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-f"
+ "east"
+ ];
+ };
+
+ # Swap Windows
+ "super-shift-h" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-s"
+ "west"
+ ];
+ };
+ "super-shift-j" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-s"
+ "south"
+ ];
+ };
+ "super-shift-k" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-s"
+ "north"
+ ];
+ };
+ "super-shift-l" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-s"
+ "east"
+ ];
+ };
+
+ # Desktop Navigation (1-9 and 0 for 10)
+ "super-1" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "1"
+ ];
+ };
+ "super-2" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "2"
+ ];
+ };
+ "super-3" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "3"
+ ];
+ };
+ "super-4" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "4"
+ ];
+ };
+ "super-5" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "5"
+ ];
+ };
+ "super-6" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "6"
+ ];
+ };
+ "super-7" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "7"
+ ];
+ };
+ "super-8" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "8"
+ ];
+ };
+ "super-9" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "9"
+ ];
+ };
+ "super-0" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "desktop"
+ "-f"
+ "10"
+ ];
+ };
+
+ # Move focused window to Desktop (Optional but common)
+ "super-shift-1" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "1"
+ ];
+ };
+ "super-shift-2" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "2"
+ ];
+ };
+ "super-shift-3" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "3"
+ ];
+ };
+ "super-shift-4" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "4"
+ ];
+ };
+ "super-shift-5" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "5"
+ ];
+ };
+ "super-shift-6" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "6"
+ ];
+ };
+ "super-shift-7" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "7"
+ ];
+ };
+ "super-shift-8" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "8"
+ ];
+ };
+ "super-shift-9" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "9"
+ ];
+ };
+ "super-shift-0" = {
+ launch = [
+ "${pkgs.bspwm}/bin/bspc"
+ "node"
+ "-d"
+ "10"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/kitty.nix b/modules/desktop/xremap/keybindings/kitty.nix
new file mode 100644
index 0000000..fd3ea1a
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/kitty.nix
@@ -0,0 +1,30 @@
+{ pkgs }:
+
+{
+
+ "super-t" = {
+ launch = [ "${pkgs.kitty}/bin/kitty" ];
+ };
+ "super-f" = {
+ launch = [
+ "${pkgs.kitty}/bin/kitty"
+ "--title"
+ "File Manager"
+ "--class"
+ "floating-terminal"
+ "-e"
+ "nnn"
+ ];
+ };
+ "super-s" = {
+ launch = [
+ "${pkgs.kitty}/bin/kitty"
+ "--title"
+ "Keybindings"
+ "--class"
+ "floating-terminal"
+ "-e"
+ "keybindings.sh"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/maim.nix b/modules/desktop/xremap/keybindings/maim.nix
new file mode 100644
index 0000000..f587e65
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/maim.nix
@@ -0,0 +1,19 @@
+{ pkgs }:
+
+{
+
+ "super-p" = {
+ launch = [
+ "sh"
+ "-c"
+ "${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png"
+ ];
+ };
+ "super-shift-p" = {
+ launch = [
+ "sh"
+ "-c"
+ "mkdir -p ~/Pictures/Screenshots && ${pkgs.maim}/bin/maim -s ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/pamixer.nix b/modules/desktop/xremap/keybindings/pamixer.nix
new file mode 100644
index 0000000..9e0d3c0
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/pamixer.nix
@@ -0,0 +1,26 @@
+{ pkgs }:
+
+{
+
+ "XF86AudioLowerVolume" = {
+ launch = [
+ "sh"
+ "-c"
+ "${pkgs.pamixer}/bin/pamixer --decrease 5"
+ ];
+ };
+ "XF86AudioRaiseVolume" = {
+ launch = [
+ "sh"
+ "-c"
+ "${pkgs.pamixer}/bin/pamixer --increase 5"
+ ];
+ };
+ "XF86AudioMute" = {
+ launch = [
+ "sh"
+ "-c"
+ "${pkgs.pamixer}/bin/pamixer --toggle-mute"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/playerctl.nix b/modules/desktop/xremap/keybindings/playerctl.nix
new file mode 100644
index 0000000..4bc52cb
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/playerctl.nix
@@ -0,0 +1,12 @@
+{ pkgs }:
+
+{
+
+ "XF86AudioPlay" = {
+ launch = [
+ "sh"
+ "-c"
+ "${pkgs.playerctl}/bin/playerctl play-pause"
+ ];
+ };
+}
diff --git a/modules/desktop/xremap/keybindings/rofi.nix b/modules/desktop/xremap/keybindings/rofi.nix
new file mode 100644
index 0000000..5ed820a
--- /dev/null
+++ b/modules/desktop/xremap/keybindings/rofi.nix
@@ -0,0 +1,12 @@
+{ pkgs }:
+
+{
+ # Application Launchers
+ "super-r" = {
+ launch = [
+ "${pkgs.zsh}/bin/zsh"
+ "-c"
+ "${pkgs.rofi}/bin/rofi -show drun"
+ ];
+ };
+}
diff --git a/modules/tools/kitty/default.nix b/modules/tools/kitty/default.nix
index 2162893..a0b8338 100644
--- a/modules/tools/kitty/default.nix
+++ b/modules/tools/kitty/default.nix
@@ -1,4 +1,9 @@
-{ config, lib, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
{
options.tools.kitty = {
@@ -44,7 +49,7 @@
allow_remote_control = "yes";
listen_on = "unix:/tmp/kitty";
- shell = lib.mkIf config.tools.zsh.enable "zsh";
+ shell = lib.mkIf config.tools.zsh.enable "${pkgs.zsh}/bin/zsh";
};
};
};
diff --git a/modules/tools/nixvim/default.nix b/modules/tools/nixvim/default.nix
index f9c604e..dad72c3 100644
--- a/modules/tools/nixvim/default.nix
+++ b/modules/tools/nixvim/default.nix
@@ -18,10 +18,10 @@
opts = {
number = true;
relativenumber = true;
- shiftwidth = 3;
- tabstop = 3;
- softtabstop = 3;
- expandtab = false;
+ shiftwidth = 2;
+ tabstop = 2;
+ softtabstop = 2;
+ expandtab = true;
list = true;
laststatus = 3;
foldlevel = 99;