aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'modules/desktop')
-rw-r--r--modules/desktop/display-server/x11/xinit/default.nix14
-rw-r--r--modules/desktop/display-server/x11/xinit/xinitrc4
-rw-r--r--modules/desktop/popup-manager/default.nix9
-rw-r--r--modules/desktop/popup-manager/rofi/default.nix7
-rw-r--r--modules/desktop/popup-manager/rofi/theme.rasi.mustache (renamed from modules/desktop/popup-manager/rofi/theme/theme.rasi)6
-rw-r--r--modules/desktop/popup-manager/rofi/theme/default.nix21
-rw-r--r--modules/desktop/status-bar/polybar/bars/main.nix2
-rw-r--r--modules/desktop/status-bar/polybar/default.nix18
-rw-r--r--modules/desktop/status-bar/polybar/modules/battery.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/bspwm.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/cpu.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/date.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/kernel-version.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/memory.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/time.nix2
-rw-r--r--modules/desktop/status-bar/polybar/modules/xwindow.nix2
-rw-r--r--modules/desktop/terminal/default.nix6
-rw-r--r--modules/desktop/window-manager/bspwm/default.nix3
-rw-r--r--modules/desktop/window-manager/default.nix9
-rw-r--r--modules/desktop/window-manager/sxhkd/default.nix93
-rw-r--r--modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix45
-rw-r--r--modules/desktop/window-manager/sxhkd/scripts/keybindings.sh (renamed from modules/desktop/window-manager/sxhkd/scripts/show-keybindings.sh)4
22 files changed, 136 insertions, 121 deletions
diff --git a/modules/desktop/display-server/x11/xinit/default.nix b/modules/desktop/display-server/x11/xinit/default.nix
index a064f36..e3f10f1 100644
--- a/modules/desktop/display-server/x11/xinit/default.nix
+++ b/modules/desktop/display-server/x11/xinit/default.nix
@@ -1,14 +1,20 @@
-{ lib, config, ... }:
+{ lib, config, pkgs, ... }:
{
- options = {
- desktop.display-server.x11.xinit.enable = lib.mkEnableOption "Enables xinit.";
+ options.desktop.display-server.x11.xinit = {
+ enable = lib.mkEnableOption "Enables xinit.";
};
config = lib.mkIf config.desktop.display-server.x11.xinit.enable {
home.file.".xinitrc" = {
- source = ./xinitrc;
executable = true;
+ source = pkgs.writeText ".xinitrc"
+''
+#!/bin/sh
+${if config.desktop.status-bar.polybar.enable then "polybar main &" else ""}
+${if config.desktop.window-manager.sxhkd.enable then "sxhkd &" else ""}
+exec ${config.desktop.window-manager.default}
+'';
};
};
}
diff --git a/modules/desktop/display-server/x11/xinit/xinitrc b/modules/desktop/display-server/x11/xinit/xinitrc
deleted file mode 100644
index 2ac4486..0000000
--- a/modules/desktop/display-server/x11/xinit/xinitrc
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-polybar main &
-sxhkd &
-exec bspwm
diff --git a/modules/desktop/popup-manager/default.nix b/modules/desktop/popup-manager/default.nix
index 3eacbf6..edf3dfa 100644
--- a/modules/desktop/popup-manager/default.nix
+++ b/modules/desktop/popup-manager/default.nix
@@ -1,7 +1,14 @@
-{ ... }:
+{ lib, ... }:
{
imports = [
./rofi
];
+
+ options.desktop.popup-manager = {
+ application-launcher.default = lib.mkOption {
+ type = lib.types.str;
+ description = "Path to the default application launcher program.";
+ };
+ };
}
diff --git a/modules/desktop/popup-manager/rofi/default.nix b/modules/desktop/popup-manager/rofi/default.nix
index 5c839e1..009db89 100644
--- a/modules/desktop/popup-manager/rofi/default.nix
+++ b/modules/desktop/popup-manager/rofi/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
{
options.desktop.popup-manager.rofi = {
@@ -6,8 +6,11 @@
};
config = lib.mkIf config.desktop.popup-manager.rofi.enable {
+ desktop.popup-manager.application-launcher.default = "${pkgs.rofi}/bin/rofi -show run";
programs.rofi.enable = true;
programs.rofi.font = "FiraCode Nerd Font 16";
- programs.rofi.theme = import ./theme config;
+ programs.rofi.theme = config.scheme {
+ template = builtins.readFile ./theme.rasi.mustache;
+ };
};
}
diff --git a/modules/desktop/popup-manager/rofi/theme/theme.rasi b/modules/desktop/popup-manager/rofi/theme.rasi.mustache
index 9d808b9..02cdaf3 100644
--- a/modules/desktop/popup-manager/rofi/theme/theme.rasi
+++ b/modules/desktop/popup-manager/rofi/theme.rasi.mustache
@@ -27,12 +27,18 @@ configuration {
padding: 0;
spacing: 0;
+ bg: #{{base00-hex}};
+ bg-alt: #{{base01-hex}};
+ fg: #{{base07-hex}};
+ fg-alt: #{{base03-hex}};
+
background-color: @bg;
text-color: @fg;
}
window {
transparency: "real";
+ border-color: #{{base03-hex}};
}
mainbox {
diff --git a/modules/desktop/popup-manager/rofi/theme/default.nix b/modules/desktop/popup-manager/rofi/theme/default.nix
deleted file mode 100644
index b0b8173..0000000
--- a/modules/desktop/popup-manager/rofi/theme/default.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-config:
-
-with config.scheme.withHashtag;
-builtins.toFile "theme.rasi"
-''
-${builtins.readFile ./theme.rasi}
-configuration {
- font: "${config.programs.rofi.font}";
-}
-
-* {
- bg: ${base00};
- bg-alt: ${base01};
- fg: ${base07};
- fg-alt: ${base03};
-}
-
-window {
- border-color: ${base03};
-}
-''
diff --git a/modules/desktop/status-bar/polybar/bars/main.nix b/modules/desktop/status-bar/polybar/bars/main.nix
index 630664d..a36f97a 100644
--- a/modules/desktop/status-bar/polybar/bars/main.nix
+++ b/modules/desktop/status-bar/polybar/bars/main.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/default.nix b/modules/desktop/status-bar/polybar/default.nix
index 7608c38..4f7ace3 100644
--- a/modules/desktop/status-bar/polybar/default.nix
+++ b/modules/desktop/status-bar/polybar/default.nix
@@ -10,18 +10,18 @@
services.polybar.script = "polybar main &";
services.polybar.config = {
- "bar/main" = import ./bars/main.nix config;
- "module/xwindow" = import ./modules/xwindow.nix config;
+ "bar/main" = import ./bars/main.nix { inherit config; };
+ "module/xwindow" = import ./modules/xwindow.nix { inherit config; };
"module/bspwm" =
if config.desktop.window-manager.bspwm.enable then
- import ./modules/bspwm.nix config
+ import ./modules/bspwm.nix { inherit config; }
else null;
- "module/cpu" = import ./modules/cpu.nix config;
- "module/memory" = import ./modules/memory.nix config;
- "module/date" = import ./modules/date.nix config;
- "module/time" = import ./modules/time.nix config;
- "module/battery" = import ./modules/battery.nix config;
- "module/kernel-version" = import ./modules/kernel-version.nix config;
+ "module/cpu" = import ./modules/cpu.nix { inherit config; };
+ "module/memory" = import ./modules/memory.nix { inherit config; };
+ "module/date" = import ./modules/date.nix { inherit config; };
+ "module/time" = import ./modules/time.nix { inherit config; };
+ "module/battery" = import ./modules/battery.nix { inherit config; };
+ "module/kernel-version" = import ./modules/kernel-version.nix { inherit config; };
};
};
}
diff --git a/modules/desktop/status-bar/polybar/modules/battery.nix b/modules/desktop/status-bar/polybar/modules/battery.nix
index 9860c3c..6d4aef9 100644
--- a/modules/desktop/status-bar/polybar/modules/battery.nix
+++ b/modules/desktop/status-bar/polybar/modules/battery.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/bspwm.nix b/modules/desktop/status-bar/polybar/modules/bspwm.nix
index 7ec5c6d..0eaac30 100644
--- a/modules/desktop/status-bar/polybar/modules/bspwm.nix
+++ b/modules/desktop/status-bar/polybar/modules/bspwm.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/cpu.nix b/modules/desktop/status-bar/polybar/modules/cpu.nix
index f118990..403add3 100644
--- a/modules/desktop/status-bar/polybar/modules/cpu.nix
+++ b/modules/desktop/status-bar/polybar/modules/cpu.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/date.nix b/modules/desktop/status-bar/polybar/modules/date.nix
index 11a5934..9ebfd77 100644
--- a/modules/desktop/status-bar/polybar/modules/date.nix
+++ b/modules/desktop/status-bar/polybar/modules/date.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/kernel-version.nix b/modules/desktop/status-bar/polybar/modules/kernel-version.nix
index a900264..e6822fa 100644
--- a/modules/desktop/status-bar/polybar/modules/kernel-version.nix
+++ b/modules/desktop/status-bar/polybar/modules/kernel-version.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/memory.nix b/modules/desktop/status-bar/polybar/modules/memory.nix
index 1aff8a3..a09d4a8 100644
--- a/modules/desktop/status-bar/polybar/modules/memory.nix
+++ b/modules/desktop/status-bar/polybar/modules/memory.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/time.nix b/modules/desktop/status-bar/polybar/modules/time.nix
index e4c7cbe..f3e0054 100644
--- a/modules/desktop/status-bar/polybar/modules/time.nix
+++ b/modules/desktop/status-bar/polybar/modules/time.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/status-bar/polybar/modules/xwindow.nix b/modules/desktop/status-bar/polybar/modules/xwindow.nix
index 23245ba..833899e 100644
--- a/modules/desktop/status-bar/polybar/modules/xwindow.nix
+++ b/modules/desktop/status-bar/polybar/modules/xwindow.nix
@@ -1,4 +1,4 @@
-config:
+{ config }:
with config.scheme.withHashtag;
{
diff --git a/modules/desktop/terminal/default.nix b/modules/desktop/terminal/default.nix
index 534b742..60b1e59 100644
--- a/modules/desktop/terminal/default.nix
+++ b/modules/desktop/terminal/default.nix
@@ -5,9 +5,9 @@
./alacritty
];
- options = {
- desktop.terminal.default = lib.mkOption {
- type = lib.types.string;
+ options.desktop.terminal = {
+ default = lib.mkOption {
+ type = lib.types.str;
description = "Path to the default terminal program.";
};
};
diff --git a/modules/desktop/window-manager/bspwm/default.nix b/modules/desktop/window-manager/bspwm/default.nix
index da9aa12..96df979 100644
--- a/modules/desktop/window-manager/bspwm/default.nix
+++ b/modules/desktop/window-manager/bspwm/default.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
{
options.desktop.window-manager.bspwm = {
@@ -6,6 +6,7 @@
};
config = lib.mkIf config.desktop.window-manager.bspwm.enable {
+ desktop.window-manager.default = "${pkgs.bspwm}/bin/bspwm";
xsession.windowManager.bspwm.enable = true;
xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; {
diff --git a/modules/desktop/window-manager/default.nix b/modules/desktop/window-manager/default.nix
index c1de8c5..23c5d6e 100644
--- a/modules/desktop/window-manager/default.nix
+++ b/modules/desktop/window-manager/default.nix
@@ -1,8 +1,15 @@
-{ ... }:
+{ lib, ... }:
{
imports = [
./bspwm
./sxhkd
];
+
+ options.desktop.window-manager = {
+ default = lib.mkOption {
+ type = lib.types.str;
+ description = "Path to the default window manager program.";
+ };
+ };
}
diff --git a/modules/desktop/window-manager/sxhkd/default.nix b/modules/desktop/window-manager/sxhkd/default.nix
index 3673b48..decad25 100644
--- a/modules/desktop/window-manager/sxhkd/default.nix
+++ b/modules/desktop/window-manager/sxhkd/default.nix
@@ -12,68 +12,35 @@
let
modKey = "alt";
createKeybinding = keybinding: description: "# ${description}\n${modKey} + ${keybinding}";
- in {
- ${(createKeybinding
- "s"
- "Show keybindings.")}
- = pkgs.writeShellScript
- "show-keybindings.sh"
- (builtins.readFile ./scripts/show-keybindings.sh);
-
- ${(createKeybinding
- "r"
- "Launch rofi.")}
- = "rofi -show run";
-
- ${(createKeybinding
- "t"
- "Launch terminal.")}
- = config.desktop.terminal.default;
-
- ${(createKeybinding
- "f"
- "Launch File Explorer.")}
- = "${config.desktop.terminal.default} -t 'File Explorer' --class 'popup' -e lf";
-
- ${(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; \
- bspc node @parent/first -z right -20 0, \
- bspc node @parent/second -z top 0 +20; \
- bspc node @parent/first -z bottom 0 +20, \
- bspc node @parent/first -z bottom 0 -20; \
- bspc node @parent/second -z top 0 -20, \
- bspc node @parent/first -z right +20 0; \
- bspc node @parent/second -z left +20 0}
- '';
- };
+ in lib.mkMerge [
+ (
+ if config.desktop.window-manager.bspwm.enable then
+ (import ./keybindings/bspwm.nix { inherit pkgs createKeybinding; })
+ else {}
+ )
+ {
+ ${(createKeybinding
+ "s"
+ "Show keybindings.")}
+ = pkgs.writeShellScript
+ "keybindings.sh"
+ (builtins.readFile ./scripts/keybindings.sh);
+
+ ${(createKeybinding
+ "r"
+ "Application launcher.")}
+ = config.desktop.popup-manager.application-launcher.default;
+
+ ${(createKeybinding
+ "t"
+ "Launch terminal.")}
+ = config.desktop.terminal.default;
+
+ ${(createKeybinding
+ "f"
+ "Launch File Manager.")}
+ = "${config.desktop.terminal.default} -t 'File Manager' --class popup -e ${config.tools.file-manager.default}";
+ }
+ ];
};
}
diff --git a/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix b/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
new file mode 100644
index 0000000..1d66d16
--- /dev/null
+++ b/modules/desktop/window-manager/sxhkd/keybindings/bspwm.nix
@@ -0,0 +1,45 @@
+{ createKeybinding, pkgs }:
+
+let
+ bspc = "${pkgs.bspwm}/bin/bspc";
+in {
+ ${(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/show-keybindings.sh b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
index db7863d..5e6b356 100644
--- a/modules/desktop/window-manager/sxhkd/scripts/show-keybindings.sh
+++ b/modules/desktop/window-manager/sxhkd/scripts/keybindings.sh
@@ -1,6 +1,4 @@
#!/bin/sh
-SXHKD_CONFIG="$HOME/.config/sxhkd/sxhkdrc"
-
awk '
/^#/ {
desc = substr($0, 3)
@@ -10,4 +8,4 @@ awk '
getline
print cmd " : " desc
}
-' "$SXHKD_CONFIG" | rofi -dmenu -i -p "Keybindings"
+' "$HOME/.config/sxhkd/sxhkdrc" | rofi -dmenu -i -p "Keybindings"