From 24ec61365b26d3fa6238e2a5ad3c529ec1fb8215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 14 Jul 2019 14:45:41 +0100 Subject: [PATCH] Extract polybar settings --- nixos/home.nix | 2 + nixos/polybar.nix | 108 ++++++++++++++++++++++++++++++++++++++ nixos/user-xsession.nix | 111 +++------------------------------------- 3 files changed, 116 insertions(+), 105 deletions(-) create mode 100644 nixos/polybar.nix diff --git a/nixos/home.nix b/nixos/home.nix index 252d2c84..bade3fd4 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -26,6 +26,8 @@ in ]; home.sessionVariables = { TERMINAL="alacritty"; + GDK_SCALE="2"; + QT_AUTO_SCREEN_SCALE_FACTOR="1"; }; imports = [ diff --git a/nixos/polybar.nix b/nixos/polybar.nix new file mode 100644 index 00000000..beb78690 --- /dev/null +++ b/nixos/polybar.nix @@ -0,0 +1,108 @@ +{ config, pkgs, ... }: +{ + services.polybar = { + enable = true; + script = "polybar main_bar &"; + config = { + "bar/main_bar" = { + bottom = "false"; + height = 50; + fixed-center = "true"; + line-size = 6; + padding-right = "1%"; + module-margin-left = 1; + module-margin-right = 1; + wm-restack = "bspwm"; + modules-left = "bspwm xwindow"; + modules-center = "date"; + modules-right = "org-clock volume backlight filesystem memory cpu battery network"; + }; + "module/bspwm" = { + type = "internal/bspwm"; + format = " "; + label-monocle = "M"; + label-floating = "S"; + fuzzy-match = "true"; + ws-icon-0 = "1;"; + ws-icon-1 = "2;"; + ws-icon-2 = "3;"; + ws-icon-3 = "4;"; + ws-icon-4 = "5;♞"; + ws-icon-default = ""; + label-mode-padding = "2"; + label-focused = "%icon%"; + label-focused-padding = 2; + label-empty = ''''; + label-occupied = "%icon%"; + label-occupied-padding = 2; + label-urgent = "%icon%"; + label-urgent-padding = 2; + }; + "module/date" = { + type = "internal/date"; + interval = 5; + date = "%m-%d %a"; + time = "%H:%M"; + label = "%date% %time%"; + }; + "module/battery" = { + type = "internal/battery"; + battery = "BAT1"; + adapter = "ADP1"; + full-at = 96; + format-charging = " "; + format-discharging = " "; + format-full = " "; + ramp-capacity-0 = ""; + ramp-capacity-1 = ""; + ramp-capacity-2 = ""; + ramp-capacity-3 = ""; + ramp-capacity-4 = ""; + }; + "settings" = {screenchange-reload = "true";}; + "module/xwindow" = { + type = "internal/xwindow"; + label = "%title:0:30:...%"; + label-padding = 10; + }; + "module/network" = { + type = "internal/network"; + interface = "wlp1s0"; + interval = "3.0"; + format-connected = ""; + label-connected = " %essid%"; + }; + "module/cpu" = { + type = "internal/cpu"; + label = " %percentage:2%%"; + }; + "module/memory" = { + type = "internal/memory"; + label = " %percentage_used%%"; + }; + "module/filesystem" = { + type = "internal/fs"; + mount-0 = "/"; + mount-1 = "/home"; + label-mounted = " %percentage_used%%"; + }; + "module/volume" = { + type = "internal/alsa"; + label-volume = " %percentage%"; + label-muted = ""; + click-left = "pactl set-sink-mute 0 toggle"; + }; + "module/backlight" = { + type = "internal/backlight"; + format = ""; + card = "intel_backlight"; + ramp-0 = "🌕"; + ramp-1 = "🌔"; + ramp-2 = "🌓"; + ramp-3 = "🌒"; + ramp-4 = "🌑"; + }; + }; + }; + +} diff --git a/nixos/user-xsession.nix b/nixos/user-xsession.nix index 34475c8d..6538f062 100644 --- a/nixos/user-xsession.nix +++ b/nixos/user-xsession.nix @@ -6,110 +6,6 @@ in services = { network-manager-applet.enable = true; - polybar = { - enable = true; - script = "polybar main_bar &"; - config = { - "bar/main_bar" = { - bottom = "false"; - height = 50; - fixed-center = "true"; - line-size = 6; - padding-right = "1%"; - module-margin-left = 1; - module-margin-right = 1; - wm-restack = "bspwm"; - modules-left = "bspwm xwindow"; - modules-center = "date"; - modules-right = "org-clock volume backlight filesystem memory cpu battery network"; - }; - "module/bspwm" = { - type = "internal/bspwm"; - format = " "; - label-monocle = "M"; - label-floating = "S"; - fuzzy-match = "true"; - ws-icon-0 = "1;"; - ws-icon-1 = "2;"; - ws-icon-2 = "3;"; - ws-icon-3 = "4;"; - ws-icon-4 = "5;♞"; - ws-icon-default = ""; - label-mode-padding = "2"; - label-focused = "%icon%"; - label-focused-padding = 2; - label-empty = ''''; - label-occupied = "%icon%"; - label-occupied-padding = 2; - label-urgent = "%icon%"; - label-urgent-padding = 2; - }; - "module/date" = { - type = "internal/date"; - interval = 5; - date = "%m-%d %a"; - time = "%H:%M"; - label = "%date% %time%"; - }; - "module/battery" = { - type = "internal/battery"; - battery = "BAT1"; - adapter = "ADP1"; - full-at = 96; - format-charging = " "; - format-discharging = " "; - format-full = " "; - ramp-capacity-0 = ""; - ramp-capacity-1 = ""; - ramp-capacity-2 = ""; - ramp-capacity-3 = ""; - ramp-capacity-4 = ""; - }; - "settings" = {screenchange-reload = "true";}; - "module/xwindow" = { - type = "internal/xwindow"; - label = "%title:0:30:...%"; - label-padding = 10; - }; - "module/network" = { - type = "internal/network"; - interface = "wlp1s0"; - interval = "3.0"; - format-connected = ""; - label-connected = " %essid%"; - }; - "module/cpu" = { - type = "internal/cpu"; - label = " %percentage:2%%"; - }; - "module/memory" = { - type = "internal/memory"; - label = " %percentage_used%%"; - }; - "module/filesystem" = { - type = "internal/fs"; - mount-0 = "/"; - mount-1 = "/home"; - label-mounted = " %percentage_used%%"; - }; - "module/volume" = { - type = "internal/alsa"; - label-volume = " %percentage%"; - label-muted = ""; - click-left = "pactl set-sink-mute 0 toggle"; - }; - "module/backlight" = { - type = "internal/backlight"; - format = ""; - card = "intel_backlight"; - ramp-0 = "🌕"; - ramp-1 = "🌔"; - ramp-2 = "🌓"; - ramp-3 = "🌒"; - ramp-4 = "🌑"; - }; - }; - }; }; xsession = { @@ -134,12 +30,17 @@ in keybindings = { "${mod}+Return" = "exec i3-sensible-terminal"; "${mod}+Shift+q" = "kill"; - "${mod}+d" = "exec ${pkgs.rofi}/bin/rofi -show combi -combi-modi window#run#ssh -modi combi"; + "${mod}+r" = "exec ${pkgs.rofi}/bin/rofi -show combi -combi-modi window#run#ssh -modi combi"; "${mod}+f" = "fullscreen toggle"; "${mod}+l" = "exec loginctl lock-session"; "${mod}+Shift+e" = "exec i3-msg exit"; + "${mod}+Shift+r" = "restart"; }; }; }; }; + + imports = [ + ./polybar.nix + ]; }