From 51d537e03ad877566f00af3c6a1c00340512ac65 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Thu, 12 Mar 2026 18:48:40 +0530 Subject: Using spaces instead of tabs --- modules/desktop/bspwm/default.nix | 72 +++++++++--------- modules/desktop/default.nix | 50 ++++++------- modules/desktop/gtk/default.nix | 24 +++--- modules/desktop/polybar/bar/default.nix | 2 +- modules/desktop/polybar/bar/main.nix | 66 ++++++++--------- modules/desktop/polybar/default.nix | 32 ++++---- modules/desktop/polybar/module/battery.nix | 70 +++++++++--------- modules/desktop/polybar/module/bspwm.nix | 32 ++++---- modules/desktop/polybar/module/cpu.nix | 8 +- modules/desktop/polybar/module/date.nix | 10 +-- modules/desktop/polybar/module/default.nix | 26 +++---- .../desktop/polybar/module/ethernet-separator.nix | 18 ++--- modules/desktop/polybar/module/ethernet.nix | 18 ++--- modules/desktop/polybar/module/memory.nix | 8 +- modules/desktop/polybar/module/separator.nix | 4 +- modules/desktop/polybar/module/time.nix | 10 +-- modules/desktop/polybar/module/volume.nix | 16 ++-- modules/desktop/polybar/module/wifi-separator.nix | 18 ++--- modules/desktop/polybar/module/wifi.nix | 32 ++++---- modules/desktop/polybar/module/xwindow.nix | 4 +- modules/desktop/sxhkd/default.nix | 76 +++++++++---------- .../desktop/sxhkd/keybindings/brightnessctl.nix | 20 ++--- modules/desktop/sxhkd/keybindings/bspwm.nix | 78 ++++++++++---------- modules/desktop/sxhkd/keybindings/maim.nix | 20 ++--- modules/desktop/sxhkd/keybindings/pamixer.nix | 30 ++++---- modules/desktop/sxhkd/keybindings/playerctl.nix | 10 +-- modules/desktop/sxhkd/scripts/keybindings.sh | 86 +++++++++++----------- 27 files changed, 420 insertions(+), 420 deletions(-) (limited to 'modules/desktop') diff --git a/modules/desktop/bspwm/default.nix b/modules/desktop/bspwm/default.nix index 6b6acef..1248946 100644 --- a/modules/desktop/bspwm/default.nix +++ b/modules/desktop/bspwm/default.nix @@ -1,46 +1,46 @@ { config, lib, pkgs, ... }: { - config = lib.mkIf config.desktop.enable { - xsession.windowManager.bspwm.enable = true; - - xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; { - window_gap = 10; - 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 = "mod4"; - 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 = '' + config = lib.mkIf config.desktop.enable { + xsession.windowManager.bspwm.enable = true; + + xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; { + window_gap = 10; + 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 = "mod4"; + 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 = '' for monitor in $(xrandr -q | grep -w 'connected' | cut -d' ' -f1); do - bspc monitor "$monitor" -d '1' '2' '3' '4' '5' '6' + bspc monitor "$monitor" -d '1' '2' '3' '4' '5' '6' done ${config.services.polybar.script} ${if config.tools.feh.enable then - "${pkgs.feh}/bin/feh --bg-scale ${../../../assets/skeleton-mage.png}" + "${pkgs.feh}/bin/feh --bg-scale ${../../../assets/skeleton-mage.png}" else "xsetroot -solid \"${config.scheme.withHashtag.base00}\""} - ''; - }; + ''; + }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index eef9b30..143978c 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,32 +1,32 @@ { lib, config, pkgs, ... }: { - imports = [ - ./bspwm - ./gtk - ./polybar - ./sxhkd - ]; + imports = [ + ./bspwm + ./gtk + ./polybar + ./sxhkd + ]; - options.desktop = { - enable = lib.mkEnableOption "Enables graphical interface."; - }; - - config = lib.mkIf config.desktop.enable { - xdg.enable = true; - xsession.enable = true; - - home.file.".xinitrc" = { - text = '' -#!/bin/sh + options.desktop = { + enable = lib.mkEnableOption "Enables graphical interface."; + }; -[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources -[ -f ~/.profile ] && . ~/.profile -[ -f ~/.xsession ] && . ~/.xsession + config = lib.mkIf config.desktop.enable { + xdg.enable = true; + xsession.enable = true; -exec ${pkgs.bspwm}/bin/bspwm -''; - executable = true; - }; - }; + home.file.".xinitrc" = { + text = '' + #!/bin/sh + + [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources + [ -f ~/.profile ] && . ~/.profile + [ -f ~/.xsession ] && . ~/.xsession + + exec ${pkgs.bspwm}/bin/bspwm + ''; + executable = true; + }; + }; } diff --git a/modules/desktop/gtk/default.nix b/modules/desktop/gtk/default.nix index f5c5067..3e32a2a 100644 --- a/modules/desktop/gtk/default.nix +++ b/modules/desktop/gtk/default.nix @@ -1,16 +1,16 @@ { config, lib, pkgs, ... }: { - config = lib.mkIf config.desktop.enable { - gtk = { - enable = true; - colorScheme = "dark"; - theme = { - package = pkgs.nightfox-gtk-theme.override { - tweakVariants = [ "carbonfox" ]; - }; - name = "Nightfox-Dark-Carbonfox"; - }; - }; - }; + config = lib.mkIf config.desktop.enable { + gtk = { + enable = true; + colorScheme = "dark"; + theme = { + package = pkgs.nightfox-gtk-theme.override { + tweakVariants = [ "carbonfox" ]; + }; + name = "Nightfox-Dark-Carbonfox"; + }; + }; + }; } diff --git a/modules/desktop/polybar/bar/default.nix b/modules/desktop/polybar/bar/default.nix index 23a43c4..9efe672 100644 --- a/modules/desktop/polybar/bar/default.nix +++ b/modules/desktop/polybar/bar/default.nix @@ -1,5 +1,5 @@ { config, lib }: { - "bar/main" = import ./main.nix { inherit config lib; }; + "bar/main" = import ./main.nix { inherit config lib; }; } diff --git a/modules/desktop/polybar/bar/main.nix b/modules/desktop/polybar/bar/main.nix index 0f38ae4..d96fe09 100644 --- a/modules/desktop/polybar/bar/main.nix +++ b/modules/desktop/polybar/bar/main.nix @@ -2,38 +2,38 @@ with config.scheme.withHashtag; let - largerFontSize = toString (builtins.ceil (config.fonts.size * 9.0 / 8.0)); + largerFontSize = toString (builtins.ceil (config.fonts.size * 9.0 / 8.0)); in { - width = "100%:-20"; - fixed-center = false; - height = 35; - override-redirect = false; - wm-restack = "bspwm"; - enable-ipc = true; - - border-top-size = 1; - border-bottom-size = 1; - border-left-size = 1; - border-right-size = 1; - border-color = base03; - - background = base00; - foreground = base05; - - line-size = 3; - line-color = base08; - - padding-left = 1; - padding-right = 1; - - offset-x = "10"; - offset-y = "10"; - - font-0 = "${config.fonts.normal}:pixelsize=${toString config.fonts.size};3"; - font-1 = "${config.fonts.normal}:weight=Bold:pixelsize=${largerFontSize};3"; - font-2 = "${config.fonts.normal}:style=Light:pixelsize=${largerFontSize};2"; - - modules-left = "bspwm separator"; - modules-center = "xwindow"; - modules-right = "separator volume separator battery separator wifi wifi-separator ethernet ethernet-separator time separator memory separator cpu separator date"; + width = "100%:-20"; + fixed-center = false; + height = 35; + override-redirect = false; + wm-restack = "bspwm"; + enable-ipc = true; + + border-top-size = 1; + border-bottom-size = 1; + border-left-size = 1; + border-right-size = 1; + border-color = base03; + + background = base00; + foreground = base05; + + line-size = 3; + line-color = base08; + + padding-left = 1; + padding-right = 1; + + offset-x = "10"; + offset-y = "10"; + + font-0 = "${config.fonts.normal}:pixelsize=${toString config.fonts.size};3"; + font-1 = "${config.fonts.normal}:weight=Bold:pixelsize=${largerFontSize};3"; + font-2 = "${config.fonts.normal}:style=Light:pixelsize=${largerFontSize};2"; + + modules-left = "bspwm separator"; + modules-center = "xwindow"; + modules-right = "separator volume separator battery separator wifi wifi-separator ethernet ethernet-separator time separator memory separator cpu separator date"; } diff --git a/modules/desktop/polybar/default.nix b/modules/desktop/polybar/default.nix index de95a49..ec8d4f5 100644 --- a/modules/desktop/polybar/default.nix +++ b/modules/desktop/polybar/default.nix @@ -1,20 +1,20 @@ { config, lib, pkgs, ... }: { - config = lib.mkIf config.desktop.enable { - services.polybar.enable = true; - services.polybar.package = (pkgs.polybar.override { - pulseSupport = true; - }); - services.polybar.script = "${config.services.polybar.package}/bin/polybar main &"; - services.polybar.config = lib.mkMerge [ - (import ./bar { inherit config lib; }) - (import ./module { inherit config lib; }) - { - settings = { - screenchange-reload = true; - }; - } - ]; - }; + config = lib.mkIf config.desktop.enable { + services.polybar.enable = true; + services.polybar.package = (pkgs.polybar.override { + pulseSupport = true; + }); + services.polybar.script = "${config.services.polybar.package}/bin/polybar main &"; + services.polybar.config = lib.mkMerge [ + (import ./bar { inherit config lib; }) + (import ./module { inherit config lib; }) + { + settings = { + screenchange-reload = true; + }; + } + ]; + }; } diff --git a/modules/desktop/polybar/module/battery.nix b/modules/desktop/polybar/module/battery.nix index cdf3b86..dc9e6f4 100644 --- a/modules/desktop/polybar/module/battery.nix +++ b/modules/desktop/polybar/module/battery.nix @@ -2,39 +2,39 @@ with config.scheme.withHashtag; { - type = "internal/battery"; - battery = "BAT1"; - adapter = "ADP1"; - - low-at = 0; - format-charging = "%{T2}%{F${base03}}%{F-}%{T-} "; - format-discharging = "%{T2}%{F${base03}}%{F-}%{T-} "; - format-full-prefix = "󰁹 "; - - label-charging = "%percentage:3%%"; - label-discharging = "%percentage:3%%"; - - ramp-capacity-0 = "󰁺"; - ramp-capacity-1 = "󰁻"; - ramp-capacity-2 = "󰁼"; - ramp-capacity-3 = "󰁽"; - ramp-capacity-4 = "󰁾"; - ramp-capacity-5 = "󰁿"; - ramp-capacity-6 = "󰂀"; - ramp-capacity-7 = "󰂁"; - ramp-capacity-8 = "󰂂"; - ramp-capacity-9 = "󰁹"; - - animation-charging-0 = "󰁺"; - animation-charging-1 = "󰁻"; - animation-charging-2 = "󰁼"; - animation-charging-3 = "󰁽"; - animation-charging-4 = "󰁾"; - animation-charging-5 = "󰁿"; - animation-charging-6 = "󰂀"; - animation-charging-7 = "󰂁"; - animation-charging-8 = "󰂂"; - animation-charging-9 = "󰁹"; - - animation-charging-framerate = 750; + type = "internal/battery"; + battery = "BAT1"; + adapter = "ADP1"; + + low-at = 0; + format-charging = "%{T2}%{F${base03}}%{F-}%{T-} "; + format-discharging = "%{T2}%{F${base03}}%{F-}%{T-} "; + format-full-prefix = "󰁹 "; + + label-charging = "%percentage:3%%"; + label-discharging = "%percentage:3%%"; + + ramp-capacity-0 = "󰁺"; + ramp-capacity-1 = "󰁻"; + ramp-capacity-2 = "󰁼"; + ramp-capacity-3 = "󰁽"; + ramp-capacity-4 = "󰁾"; + ramp-capacity-5 = "󰁿"; + ramp-capacity-6 = "󰂀"; + ramp-capacity-7 = "󰂁"; + ramp-capacity-8 = "󰂂"; + ramp-capacity-9 = "󰁹"; + + animation-charging-0 = "󰁺"; + animation-charging-1 = "󰁻"; + animation-charging-2 = "󰁼"; + animation-charging-3 = "󰁽"; + animation-charging-4 = "󰁾"; + animation-charging-5 = "󰁿"; + animation-charging-6 = "󰂀"; + animation-charging-7 = "󰂁"; + animation-charging-8 = "󰂂"; + animation-charging-9 = "󰁹"; + + animation-charging-framerate = 750; } diff --git a/modules/desktop/polybar/module/bspwm.nix b/modules/desktop/polybar/module/bspwm.nix index 3c8f64a..a760acf 100644 --- a/modules/desktop/polybar/module/bspwm.nix +++ b/modules/desktop/polybar/module/bspwm.nix @@ -2,20 +2,20 @@ with config.scheme.withHashtag; { - type = "internal/bspwm"; - - label-focused = "%index%"; - label-focused-underline = "${base0D}"; - label-focused-padding = 1; - - label-occupied = "%index%"; - label-occupied-padding = 1; - - label-urgent = "%index%"; - label-urgent-underline = "${base08}"; - label-urgent-padding = 1; - - label-empty = "%index%"; - label-empty-foreground = "${base03}"; - label-empty-padding = 1; + type = "internal/bspwm"; + + label-focused = "%index%"; + label-focused-underline = "${base0D}"; + label-focused-padding = 1; + + label-occupied = "%index%"; + label-occupied-padding = 1; + + label-urgent = "%index%"; + label-urgent-underline = "${base08}"; + label-urgent-padding = 1; + + label-empty = "%index%"; + label-empty-foreground = "${base03}"; + label-empty-padding = 1; } diff --git a/modules/desktop/polybar/module/cpu.nix b/modules/desktop/polybar/module/cpu.nix index 754e6eb..64d5b47 100644 --- a/modules/desktop/polybar/module/cpu.nix +++ b/modules/desktop/polybar/module/cpu.nix @@ -2,8 +2,8 @@ with config.scheme.withHashtag; { - type = "internal/cpu"; - interval = 2; - format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; - label = "%percentage:3%%"; + type = "internal/cpu"; + interval = 2; + format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; + label = "%percentage:3%%"; } diff --git a/modules/desktop/polybar/module/date.nix b/modules/desktop/polybar/module/date.nix index 9c56121..0e432e9 100644 --- a/modules/desktop/polybar/module/date.nix +++ b/modules/desktop/polybar/module/date.nix @@ -2,9 +2,9 @@ with config.scheme.withHashtag; { - type = "internal/date"; - interval = 60; - date = "%d/%m/%Y"; - label = "%date%"; - format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; + type = "internal/date"; + interval = 60; + date = "%d/%m/%Y"; + label = "%date%"; + format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; } diff --git a/modules/desktop/polybar/module/default.nix b/modules/desktop/polybar/module/default.nix index 1a243b0..57854ca 100644 --- a/modules/desktop/polybar/module/default.nix +++ b/modules/desktop/polybar/module/default.nix @@ -1,17 +1,17 @@ { config, lib }: { - "module/battery" = import ./battery.nix { inherit config; }; - "module/bspwm" = import ./bspwm.nix { inherit config; }; - "module/cpu" = import ./cpu.nix { inherit config; }; - "module/date" = import ./date.nix { inherit config; }; - "module/ethernet-separator" = import ./ethernet-separator.nix { inherit config; }; - "module/ethernet" = import ./ethernet.nix { inherit config; }; - "module/memory" = import ./memory.nix { inherit config; }; - "module/separator" = import ./separator.nix { inherit config; }; - "module/time" = import ./time.nix { inherit config; }; - "module/volume" = import ./volume.nix { inherit config; }; - "module/wifi-separator" = import ./wifi-separator.nix { inherit config; }; - "module/wifi" = import ./wifi.nix { inherit config; }; - "module/xwindow" = import ./xwindow.nix { inherit config; }; + "module/battery" = import ./battery.nix { inherit config; }; + "module/bspwm" = import ./bspwm.nix { inherit config; }; + "module/cpu" = import ./cpu.nix { inherit config; }; + "module/date" = import ./date.nix { inherit config; }; + "module/ethernet-separator" = import ./ethernet-separator.nix { inherit config; }; + "module/ethernet" = import ./ethernet.nix { inherit config; }; + "module/memory" = import ./memory.nix { inherit config; }; + "module/separator" = import ./separator.nix { inherit config; }; + "module/time" = import ./time.nix { inherit config; }; + "module/volume" = import ./volume.nix { inherit config; }; + "module/wifi-separator" = import ./wifi-separator.nix { inherit config; }; + "module/wifi" = import ./wifi.nix { inherit config; }; + "module/xwindow" = import ./xwindow.nix { inherit config; }; } diff --git a/modules/desktop/polybar/module/ethernet-separator.nix b/modules/desktop/polybar/module/ethernet-separator.nix index c2fefaa..2c2a738 100644 --- a/modules/desktop/polybar/module/ethernet-separator.nix +++ b/modules/desktop/polybar/module/ethernet-separator.nix @@ -2,13 +2,13 @@ with config.scheme.withHashtag; { - type = "internal/network"; - interface = "enp4s0"; - interface-type = "wired"; - - format-connected = " %{F${base03}}%{T3}│%{T-}%{F-} "; - format-disconnected = ""; - - label-connected = ""; - label-disconnected = ""; + type = "internal/network"; + interface = "enp4s0"; + interface-type = "wired"; + + format-connected = " %{F${base03}}%{T3}│%{T-}%{F-} "; + format-disconnected = ""; + + label-connected = ""; + label-disconnected = ""; } diff --git a/modules/desktop/polybar/module/ethernet.nix b/modules/desktop/polybar/module/ethernet.nix index 3e2b48d..28c7a1b 100644 --- a/modules/desktop/polybar/module/ethernet.nix +++ b/modules/desktop/polybar/module/ethernet.nix @@ -2,13 +2,13 @@ with config.scheme.withHashtag; { - type = "internal/network"; - interface = "enp4s0"; - interface-type = "wired"; - - format-connected = "%{T2}%{F${base03}}%{F-}%{T-} "; - format-disconnected = ""; - - label-connected = "%netspeed:8%"; - label-disconnected = ""; + type = "internal/network"; + interface = "enp4s0"; + interface-type = "wired"; + + format-connected = "%{T2}%{F${base03}}%{F-}%{T-} "; + format-disconnected = ""; + + label-connected = "%netspeed:8%"; + label-disconnected = ""; } diff --git a/modules/desktop/polybar/module/memory.nix b/modules/desktop/polybar/module/memory.nix index d6ab597..7f8de0a 100644 --- a/modules/desktop/polybar/module/memory.nix +++ b/modules/desktop/polybar/module/memory.nix @@ -2,8 +2,8 @@ with config.scheme.withHashtag; { - type = "internal/memory"; - interval = 2; - format-prefix = "%{T2}%{F${base03}} %{F-}%{T-} "; - label = "%gb_used:9%"; + type = "internal/memory"; + interval = 2; + format-prefix = "%{T2}%{F${base03}} %{F-}%{T-} "; + label = "%gb_used:9%"; } diff --git a/modules/desktop/polybar/module/separator.nix b/modules/desktop/polybar/module/separator.nix index 1434037..0a75a30 100644 --- a/modules/desktop/polybar/module/separator.nix +++ b/modules/desktop/polybar/module/separator.nix @@ -2,6 +2,6 @@ with config.scheme.withHashtag; { - type = "custom/text"; - label = " %{F${base03}}%{T3}│%{T-}%{F-} "; + type = "custom/text"; + label = " %{F${base03}}%{T3}│%{T-}%{F-} "; } diff --git a/modules/desktop/polybar/module/time.nix b/modules/desktop/polybar/module/time.nix index 2179c09..6fe921d 100644 --- a/modules/desktop/polybar/module/time.nix +++ b/modules/desktop/polybar/module/time.nix @@ -2,9 +2,9 @@ with config.scheme.withHashtag; { - type = "internal/date"; - interval = 30; - time = "%I:%M %p"; - label = "%time%"; - format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; + type = "internal/date"; + interval = 30; + time = "%I:%M %p"; + label = "%time%"; + format-prefix = "%{T2}%{F${base03}} %{F-}%{T-}"; } diff --git a/modules/desktop/polybar/module/volume.nix b/modules/desktop/polybar/module/volume.nix index 4dff8fb..eacd53d 100644 --- a/modules/desktop/polybar/module/volume.nix +++ b/modules/desktop/polybar/module/volume.nix @@ -2,12 +2,12 @@ with config.scheme.withHashtag; { - type = "internal/pulseaudio"; - interval = 5; - format-volume = "%{T2}%{F${base03}}%{F-}%{T-} "; - label-volume = "%percentage:3%%"; - label-muted = "%{T2}%{F${base03}} %{F-}%{T-} "; - ramp-volume-0 = " "; - ramp-volume-1 = " "; - ramp-volume-2 = " "; + type = "internal/pulseaudio"; + interval = 5; + format-volume = "%{T2}%{F${base03}}%{F-}%{T-} "; + label-volume = "%percentage:3%%"; + label-muted = "%{T2}%{F${base03}} %{F-}%{T-} "; + ramp-volume-0 = " "; + ramp-volume-1 = " "; + ramp-volume-2 = " "; } diff --git a/modules/desktop/polybar/module/wifi-separator.nix b/modules/desktop/polybar/module/wifi-separator.nix index 6b8da50..2527b68 100644 --- a/modules/desktop/polybar/module/wifi-separator.nix +++ b/modules/desktop/polybar/module/wifi-separator.nix @@ -2,13 +2,13 @@ with config.scheme.withHashtag; { - type = "internal/network"; - interface = "wlan0"; - interface-type = "wireless"; - - format-connected = " %{F${base03}}%{T3}│%{T-}%{F-} "; - format-disconnected = ""; - - label-connected = ""; - label-disconnected = ""; + type = "internal/network"; + interface = "wlan0"; + interface-type = "wireless"; + + format-connected = " %{F${base03}}%{T3}│%{T-}%{F-} "; + format-disconnected = ""; + + label-connected = ""; + label-disconnected = ""; } diff --git a/modules/desktop/polybar/module/wifi.nix b/modules/desktop/polybar/module/wifi.nix index 9f25fa2..5a4d17f 100644 --- a/modules/desktop/polybar/module/wifi.nix +++ b/modules/desktop/polybar/module/wifi.nix @@ -2,20 +2,20 @@ with config.scheme.withHashtag; { - type = "internal/network"; - interface = "wlan0"; - interface-type = "wireless"; - - format-connected = "%{T2}%{F${base03}}%{F-}%{T-} "; - format-disconnected = ""; - - label-connected = "%netspeed:8%"; - label-disconnected = ""; - - ramp-signal-0 = "󰢼"; - ramp-signal-1 = "󰢼"; - ramp-signal-2 = "󰢽"; - ramp-signal-3 = "󰢽"; - ramp-signal-4 = "󰢾"; - ramp-signal-5 = "󰢾"; + type = "internal/network"; + interface = "wlan0"; + interface-type = "wireless"; + + format-connected = "%{T2}%{F${base03}}%{F-}%{T-} "; + format-disconnected = ""; + + label-connected = "%netspeed:8%"; + label-disconnected = ""; + + ramp-signal-0 = "󰢼"; + ramp-signal-1 = "󰢼"; + ramp-signal-2 = "󰢽"; + ramp-signal-3 = "󰢽"; + ramp-signal-4 = "󰢾"; + ramp-signal-5 = "󰢾"; } diff --git a/modules/desktop/polybar/module/xwindow.nix b/modules/desktop/polybar/module/xwindow.nix index 386efe2..16574f5 100644 --- a/modules/desktop/polybar/module/xwindow.nix +++ b/modules/desktop/polybar/module/xwindow.nix @@ -1,6 +1,6 @@ { config }: { - type = "internal/xwindow"; - label = "%title:0:20:...%"; + type = "internal/xwindow"; + label = "%title:0:20:...%"; } diff --git a/modules/desktop/sxhkd/default.nix b/modules/desktop/sxhkd/default.nix index 3102efe..19bc540 100644 --- a/modules/desktop/sxhkd/default.nix +++ b/modules/desktop/sxhkd/default.nix @@ -1,42 +1,42 @@ { 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") - ]; - }; + 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 index 6cdf3e7..bc508e6 100644 --- a/modules/desktop/sxhkd/keybindings/brightnessctl.nix +++ b/modules/desktop/sxhkd/keybindings/brightnessctl.nix @@ -1,15 +1,15 @@ { createKeybindingBase, pkgs, lib }: let - brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; + brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; in lib.mkMerge [ - (createKeybindingBase - "XF86MonBrightnessDown" - "Decrease brightness." - "${brightnessctl} set 5%-") - - (createKeybindingBase - "XF86MonBrightnessUp" - "Increase brightness." - "${brightnessctl} set +5%") + (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 index ffa7d6c..cd838a3 100644 --- a/modules/desktop/sxhkd/keybindings/bspwm.nix +++ b/modules/desktop/sxhkd/keybindings/bspwm.nix @@ -1,45 +1,45 @@ { createKeybinding, pkgs, lib }: let - bspc = "${pkgs.bspwm}/bin/bspc"; + 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} + (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 index b66ec98..2092a71 100644 --- a/modules/desktop/sxhkd/keybindings/maim.nix +++ b/modules/desktop/sxhkd/keybindings/maim.nix @@ -1,15 +1,15 @@ { createKeybinding, pkgs, lib }: let - maim = "${pkgs.maim}/bin/maim"; + 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") + (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 index a45bf83..e7f056e 100644 --- a/modules/desktop/sxhkd/keybindings/pamixer.nix +++ b/modules/desktop/sxhkd/keybindings/pamixer.nix @@ -1,20 +1,20 @@ { createKeybindingBase, pkgs, lib }: let - pamixer = "${pkgs.pamixer}/bin/pamixer"; + 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") + (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 index 3e5c4e0..7c3b796 100644 --- a/modules/desktop/sxhkd/keybindings/playerctl.nix +++ b/modules/desktop/sxhkd/keybindings/playerctl.nix @@ -1,10 +1,10 @@ { createKeybindingBase, pkgs, lib }: let - playerctl = "${pkgs.playerctl}/bin/playerctl"; + playerctl = "${pkgs.playerctl}/bin/playerctl"; in lib.mkMerge [ - (createKeybindingBase - "XF86AudioPlay" - "Toggle video / audio player." - "${playerctl} play-pause") + (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 index 1548f1c..e713415 100755 --- a/modules/desktop/sxhkd/scripts/keybindings.sh +++ b/modules/desktop/sxhkd/scripts/keybindings.sh @@ -5,9 +5,9 @@ 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" + local text="$1" + local width="$2" + echo "$text" | fold -s -w "$width" } # Get terminal width @@ -33,44 +33,44 @@ border_line="├$(printf '%.0s─' $(seq 1 $max_keybinding_length))┼$(printf ' # 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))┘" + # 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 -- cgit v1.2.3