aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/window-manager
diff options
context:
space:
mode:
Diffstat (limited to 'modules/desktop/window-manager')
-rw-r--r--modules/desktop/window-manager/bspwm/bspwmrc3
-rw-r--r--modules/desktop/window-manager/bspwm/default.nix54
-rw-r--r--modules/desktop/window-manager/default.nix30
-rw-r--r--modules/desktop/window-manager/i3/default.nix38
-rw-r--r--modules/desktop/window-manager/sxhkd/default.nix46
-rw-r--r--modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix45
-rwxr-xr-xmodules/desktop/window-manager/sxhkd/scripts/keybindings.sh77
7 files changed, 0 insertions, 293 deletions
diff --git a/modules/desktop/window-manager/bspwm/bspwmrc b/modules/desktop/window-manager/bspwm/bspwmrc
deleted file mode 100644
index 8a3a35a..0000000
--- a/modules/desktop/window-manager/bspwm/bspwmrc
+++ /dev/null
@@ -1,3 +0,0 @@
-for monitor in $(xrandr -q | grep -w 'connected' | cut -d' ' -f1); do
- bspc monitor "$monitor" -d '1' '2' '3' '4' '5' '6'
-done
diff --git a/modules/desktop/window-manager/bspwm/default.nix b/modules/desktop/window-manager/bspwm/default.nix
deleted file mode 100644
index e275135..0000000
--- a/modules/desktop/window-manager/bspwm/default.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-{
- options.desktop.window-manager.bspwm = {
- enable = lib.mkEnableOption "Enables bspwm.";
- };
-
- config = lib.mkIf config.desktop.window-manager.bspwm.enable {
- assertions = [
- {
- assertion = config.desktop.window-manager.sxhkd.enable;
- message ="Module desktop.window-manager.bspwm requires desktop.window-manager.sxhkd module to be enabled.";
- }
- ];
-
- desktop.window-manager.default = lib.mkDefault "bspwm";
- desktop.window-manager.command =
- if config.desktop.window-manager.default == "bspwm" then
- "${pkgs.bspwm}/bin/bspwm"
- else lib.mkDefault "";
-
- xsession.windowManager.bspwm.enable = true;
-
- xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; {
- window_gap = config.desktop.window-manager.gap;
- split_ratio = 0.5;
- single_monocle = true;
- borderless_monocle = false;
- gapless_monocle = false;
- focus_follows_pointer = true;
- pointer_follows_focus = false;
- pointer_motion_interval = 40;
- pointer_modifier = "mod1"; # alt key
- pointer_action1 = "resize_side";
- pointer_action2 = "move";
- pointer_action3 = "resize_corner";
- normal_border_color = base02;
- active_border_color = base02;
- focused_border_color = base03;
- };
-
- xsession.windowManager.bspwm.rules = {
- "floating-termial" = {
- state = "floating";
- sticky = true;
- rectangle = "1000x600+0+0";
- center = true;
- follow = true;
- };
- };
-
- xsession.windowManager.bspwm.extraConfig = builtins.readFile ./bspwmrc;
- };
-}
diff --git a/modules/desktop/window-manager/default.nix b/modules/desktop/window-manager/default.nix
deleted file mode 100644
index 2f36bce..0000000
--- a/modules/desktop/window-manager/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ lib, ... }:
-
-{
- imports = [
- ./bspwm
- ./i3
- ./sxhkd
- ];
-
- options.desktop.window-manager = {
- default = lib.mkOption {
- type = lib.types.enum [
- "bspwm"
- "i3"
- ];
- description = "Default window manager.";
- };
-
- command = lib.mkOption {
- type = lib.types.str;
- description = "Command window manager program.";
- };
-
- gap = lib.mkOption {
- type = lib.types.int;
- default = 10;
- description = "The spacing between windows.";
- };
- };
-}
diff --git a/modules/desktop/window-manager/i3/default.nix b/modules/desktop/window-manager/i3/default.nix
deleted file mode 100644
index 369fe34..0000000
--- a/modules/desktop/window-manager/i3/default.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-{
- options.desktop.window-manager.i3 = {
- enable = lib.mkEnableOption "Enables i3.";
- };
-
- config = lib.mkIf config.desktop.window-manager.i3.enable {
- # Set i3 as the default window manager
- desktop.window-manager.default = lib.mkDefault "i3";
- desktop.window-manager.command =
- if config.desktop.window-manager.default == "i3" then
- "${pkgs.i3}/bin/i3"
- else lib.mkDefault "";
-
- xsession.windowManager.i3.enable = true;
-
- xsession.windowManager.i3.config = {
- modifier = "Mod4";
- gaps = {
- inner = config.desktop.window-manager.gap;
- };
- terminal = config.tools.terminal.command;
- fonts = {
- names = [ "FiraCode Nerd Font" ];
- size = 11.0;
- };
- bars = [
- {
- command =
- lib.mkIf
- config.desktop.status-bar.polybar.enable
- config.desktop.status-bar.polybar.command;
- }
- ];
- };
- };
-}
diff --git a/modules/desktop/window-manager/sxhkd/default.nix b/modules/desktop/window-manager/sxhkd/default.nix
deleted file mode 100644
index cab7351..0000000
--- a/modules/desktop/window-manager/sxhkd/default.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{ pkgs, config, lib, ... }:
-
-{
- options.desktop.window-manager.sxhkd = {
- enable = lib.mkEnableOption "Enables sxhkd.";
- };
-
- config = lib.mkIf config.desktop.window-manager.sxhkd.enable {
- services.sxhkd.enable = true;
- services.sxhkd.keybindings =
- let
- modKey = "alt";
- createKeybinding = keybinding: description: command: {
- "# ${description}\n${modKey} + ${keybinding}" = command;
- };
- in lib.mkMerge [
- (
- if config.desktop.window-manager.bspwm.enable then
- (import ./keybindings/bspwm.nix { inherit pkgs createKeybinding lib; })
- else {}
- )
- (lib.mkMerge [
- (createKeybinding
- "s"
- "Show keybindings."
- "${config.tools.terminal.command} --title 'Keybindings' --class floating-termial -e ${pkgs.writeShellScript "keybindings.sh" (builtins.readFile ./scripts/keybindings.sh)}"
- )
-
- (createKeybinding
- "r"
- "Application launcher."
- config.desktop.application-launcher.command)
-
- (createKeybinding
- "t"
- "Launch terminal."
- config.tools.terminal.command)
-
- (createKeybinding
- "f"
- "Launch File Manager."
- "${config.tools.terminal.command} --title 'File Manager' --class floating-termial -e ${config.tools.file-manager.command}")
- ])
- ];
- };
-}
diff --git a/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix b/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
deleted file mode 100644
index ed62ed4..0000000
--- a/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
+++ /dev/null
@@ -1,45 +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/window-manager/sxhkd/scripts/keybindings.sh b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
deleted file mode 100755
index 01bb05f..0000000
--- a/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
+++ /dev/null
@@ -1,77 +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"
-
- # Initialize variables
- 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