From 83a8a9540adf86155220703b70c5fbdc9c6c3def Mon Sep 17 00:00:00 2001 From: Frantisek Bohacek Date: Thu, 4 Apr 2024 18:35:45 +0200 Subject: [PATCH] feat: some updates too lazy to comment all of them :( --- hosts/configuration.nix | 30 +++-- hosts/home.nix | 6 +- modules/desktop/qtile/config/config.py | 8 +- modules/desktop/qtile/config/screens.py | 24 ++-- modules/desktop/qtile/config/xmonadcustom.py | 4 +- modules/desktop/qtile/home.nix | 4 + modules/programs/alacritty.nix | 25 ++++ modules/programs/home.nix | 1 + modules/programs/rofi.nix | 116 +++++++++++-------- modules/services/autorandr.nix | 4 +- modules/services/dunst.nix | 3 +- 11 files changed, 146 insertions(+), 79 deletions(-) diff --git a/hosts/configuration.nix b/hosts/configuration.nix index e808ae4..ea5a6bf 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -11,7 +11,7 @@ # └─ default.nix # -{ config, lib, pkgs, inputs, user, ... }: +{ config, nixpkgs, lib, pkgs, inputs, user, ... }: { imports = # Home Manager Modules @@ -28,7 +28,7 @@ users.groups.plugdev.members = [ "${user}" ]; users.users.${user} = { # System User isNormalUser = true; - extraGroups = [ "wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "plex" "podman" ]; + extraGroups = [ "wheel" "video" "audio" "camera" "networkmanager" "lp" "scanner" "kvm" "libvirtd" "plex" "podman" "input" "tty" ]; shell = pkgs.zsh; # Default shell }; programs.zsh.enable = true; # has to be here to set shell to zsh @@ -158,26 +158,34 @@ "nixpkgs-stable=flake:nixpkgs-stable" ]; + # package = pkgs.nixVersions.stable.overrideAttrs (old: { + # patches = old.patches or [ ] ++ [ + # (pkgs.fetchpatch { + # url = "https://github.com/NixOS/nix/commit/b6ae3be9c6ec4e9de55479188e76fc330b2304dd.patch"; + # hash = "sha256-VyIywGo1ie059wXmGWx+bNeHz9lNk6nlkJ/Qgd1kmzw="; + # }) + # ]; + # }); + settings = { + # reject-flake-config = true; + connect-timeout = 5; - flake-registry = ""; + flake-registry = ""; # Do not pollute with external flake registry auto-optimise-store = true; # Optimise syslinks substituters = [ "https://cache.nixos.org" - "https://rutherther.cachix.org" - ]; - trusted-public-keys = [ - "rutherther.cachix.org-1:O9st5Dq/VHb0T8+vwZ0aP4sjzzCn7Ry60wSyXaRW7j8=" ]; }; + gc = { # Automatic garbage collection automatic = true; dates = "weekly"; options = "--delete-older-than 2d"; }; - package = pkgs.nixVersions.unstable; # Enable nixFlakes on system + extraOptions = '' experimental-features = nix-command flakes keep-outputs = true @@ -186,6 +194,12 @@ }; nixpkgs.config.allowUnfree = true; # Allow proprietary software. + # nixpkgs.overlays = [ + # (final: prev: { + # xz = inputs.nixpkgs-stable.legacyPackages.${prev.hostPlatform.system}.xz; + # }) + # ]; + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; system = { # NixOS settings diff --git a/hosts/home.nix b/hosts/home.nix index 5294d52..5131288 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -156,12 +156,14 @@ comma bat ripgrep + + pinta ]; pointerCursor = { # This will set cursor system-wide so applications can not choose their own gtk.enable = true; - name = "Catppuccin-Frappe-Lavender-Cursors"; - package = pkgs.catppuccin-cursors.frappeLavender; + name = "Catppuccin-Frappe-Sapphire-Cursors"; + package = pkgs.catppuccin-cursors.frappeSapphire; size = 16; }; stateVersion = "23.05"; diff --git a/modules/desktop/qtile/config/config.py b/modules/desktop/qtile/config/config.py index ad81f3c..4503bfd 100644 --- a/modules/desktop/qtile/config/config.py +++ b/modules/desktop/qtile/config/config.py @@ -78,9 +78,10 @@ keys.extend([ # Spwning programs keys.extend([ - EzKey('M-', lazy.spawn('rofi -show drun')), + EzKey('M-', lazy.spawn('rofi -show drun -show-icons')), EzKey('A-', lazy.spawn('rofi -show windowcd -modi window,windowcd')), - EzKey('M-S-', lazy.spawn('rofi -show window -modi window,windowcd')), + EzKey('M-S-', lazy.spawn('rofi -show drun -theme launchpad -show-icons')), + # EzKey('M-S-', lazy.spawn('rofi -show window -modi window,windowcd')), EzKey('M-S-', lazy.spawn(terminal)), ]) @@ -133,7 +134,8 @@ keys.extend([ # Printscreen keys.extend([ - EzKey('', lazy.spawn('flameshot gui')), + EzKey('', lazy.spawn('ksnip -r')), + # EzKey('S-', lazy.spawn('ksnip -r -s')), ]) # Locking diff --git a/modules/desktop/qtile/config/screens.py b/modules/desktop/qtile/config/screens.py index 9813091..893ba57 100644 --- a/modules/desktop/qtile/config/screens.py +++ b/modules/desktop/qtile/config/screens.py @@ -16,17 +16,13 @@ def init_screens(): screens_count = len(screens_info) screens = [None] * screens_count - logger.warning(f'setting up {screens_count} screens') - for i in range(0, screens_count): screen_info = screens_info[i] systray = False if screens_count <= 2 and i == 0: systray = True - print(f'Putting systray on {i}') elif i == 1: systray = True - print(f'Putting systray on {i}') top_bar = bars.create_top_bar(systray = systray) @@ -34,16 +30,24 @@ def init_screens(): return screens +def get_screen_physical_order(): + screens = enumerate(screeninfo.get_monitors()) + s = sorted(screens, key = lambda x: (x[1].y, x[1].x)) + return map(lambda x: x[0], s) + def init_navigation_keys(keys, screens): - if len(screens) >= 4: - monitor_navigation_keys = ['q', 'w', 'e', 'r'] - else: - monitor_navigation_keys = ['w', 'e', 'r'] + order = list(get_screen_physical_order()) + # TODO: how to specify this better? + # Could be based on the fingerprint for example + monitor_navigation_keys = ['r', 'w', 'e', 'q'] for i, key in enumerate(monitor_navigation_keys): + if i >= len(order): + break + keys.extend([ - EzKey(f'M-{key}', go_to_screen(i), desc = f'Move focus to screen {i}'), - EzKey(f'M-S-{key}', lazy.window.toscreen(i), desc = f'Move window to screen {i}'), + EzKey(f'M-{key}', go_to_screen(order[i]), desc = f'Move focus to screen {i}'), + EzKey(f'M-S-{key}', lazy.window.toscreen(order[i]), desc = f'Move window to screen {i}'), ]) # Monitors changing connected displays and the lid. diff --git a/modules/desktop/qtile/config/xmonadcustom.py b/modules/desktop/qtile/config/xmonadcustom.py index 60dbc0d..8c88393 100644 --- a/modules/desktop/qtile/config/xmonadcustom.py +++ b/modules/desktop/qtile/config/xmonadcustom.py @@ -801,7 +801,7 @@ class MonadTall(_SimpleLayoutBase): self.master_length = 1 if normalize: - self.group.layout_all() + # self.group.layout_all() self.normalize() @expose_command() @@ -811,7 +811,7 @@ class MonadTall(_SimpleLayoutBase): self.master_length = len(self.clients) - 1 if normalize: - self.group.layout_all() + # self.group.layout_all() self.normalize() @expose_command diff --git a/modules/desktop/qtile/home.nix b/modules/desktop/qtile/home.nix index 03e20d9..918e88e 100644 --- a/modules/desktop/qtile/home.nix +++ b/modules/desktop/qtile/home.nix @@ -8,6 +8,10 @@ }; }; + home.packages = [ + pkgs.ksnip + ]; + xdg.configFile."qtile/config.py".source = ./config/config.py; xdg.configFile."qtile/utils.py".source = ./config/utils.py; xdg.configFile."qtile/functions.py".source = ./config/functions.py; diff --git a/modules/programs/alacritty.nix b/modules/programs/alacritty.nix index 68d4de5..2234aaa 100644 --- a/modules/programs/alacritty.nix +++ b/modules/programs/alacritty.nix @@ -7,6 +7,7 @@ { pkgs, lib, ... }: { + programs = { dircolors = { enable = true; @@ -15,6 +16,30 @@ }; }; + iamb = { + enable = true; + settings = { + profiles = { + "ditigal.xyz" = { + user_id = "@ruther:ditigal.xyz"; + }; + }; + settings = { + username_display = "displayname"; + image_preview = {}; + }; + }; + }; + + kitty = { + enable = true; + font = { + name = "FiraCode Nerd Font"; + size = 12; + }; + theme = "Chalk"; + }; + alacritty = { enable = true; settings = { diff --git a/modules/programs/home.nix b/modules/programs/home.nix index afe2fa3..578c229 100644 --- a/modules/programs/home.nix +++ b/modules/programs/home.nix @@ -12,6 +12,7 @@ [ ./alacritty.nix + ./iamb.nix ./rofi.nix ./clipmenu.nix ./firefox.nix diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 3ac9e3c..1e24c48 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -7,6 +7,13 @@ let inherit (config.lib.formats.rasi) mkLiteral; # Theme.rasi alternative. Add Theme here colors = import ../themes/colors.nix; + + themes-collection = pkgs.fetchFromGitHub { + owner = "newmanls"; + repo = "rofi-themes-collection"; + rev = "f87e08300cb1c984994efcaf7d8ae26f705226fd"; + hash = "sha256-A6zIAQvjfe/XB5GZefs4TWgD+eGICQP2Abz/sQynJPo="; + }; in { home = { @@ -15,6 +22,9 @@ in ]; }; + xdg.dataFile."rofi/themes/launchpad.rasi".source = "${themes-collection}/themes/launchpad.rasi"; + xdg.dataFile."rofi/themes/spotlight.rasi".source = "${themes-collection}/themes/spotlight-dark.rasi"; + programs = { rofi = { enable = true; @@ -22,94 +32,98 @@ in location = "center"; font = "FiraCode Nerd Font Mono 11"; theme = with colors.scheme.doom; { + # Based on spotlight theme "*" = { - bg0 = mkLiteral "#${bg}"; - bg1 = mkLiteral "#414868"; + font = "Montserrat 12"; + + bg0 = mkLiteral "#222223e6"; + bg1 = mkLiteral "#44444480"; + bg2 = mkLiteral "#51afefe6"; fg0 = mkLiteral "#${text}"; - fg1 = mkLiteral "#${text-alt}"; + fg1 = mkLiteral "#d5d5d5"; + fg2 = mkLiteral "#${fg}"; background-color = mkLiteral "transparent"; text-color = mkLiteral "@fg0"; - margin = 0; - padding = 0; - spacing = 0; - }; - - "element-icon, element-text, scrollbar" = { - cursor = mkLiteral "pointer"; + margin = mkLiteral "0"; + padding = mkLiteral "0"; + spacing = mkLiteral "0"; }; "window" = { - location = mkLiteral "northwest"; - width = mkLiteral "280px"; - x-offset = mkLiteral "8px"; - y-offset = mkLiteral "34px"; - background-color = mkLiteral "@bg0"; - border = mkLiteral "1px"; - border-color = mkLiteral "@bg1"; - border-radius = mkLiteral "6px"; + + location = mkLiteral "center"; + width = mkLiteral "640"; + border-radius = mkLiteral "0"; }; - "inputbar" = { - spacing = mkLiteral "8px"; - padding = mkLiteral "4px 8px"; - children = mkLiteral "[ entry ]"; - background-color = mkLiteral "@bg0"; + "inputbar" = { + font = "Montserrat 20"; + padding = mkLiteral "12px"; + spacing = mkLiteral "12px"; + children = mkLiteral "[ icon-search, entry ]"; + }; + + "icon-search" = { + expand = false; + filename = "search"; + size = mkLiteral "28px"; }; - "entry, element-icon, element-text" = { + "icon-search, entry, element-icon, element-text" = { vertical-align = mkLiteral "0.5"; }; - "textbox" = { - padding = mkLiteral "4px 8px"; - background-color = mkLiteral "@bg0"; + "entry" = { + font = mkLiteral "inherit"; + + placeholder = "Search"; + placeholder-color = mkLiteral "@fg2"; }; - "listview" = { - padding = mkLiteral "4px 0px"; - lines = 6; - columns = 1; - scrollbar = true; + "message" = { + border = mkLiteral "2px 0 0"; + border-color = mkLiteral "@bg1"; + background-color = mkLiteral "@bg1"; }; - "element" = { - padding = mkLiteral "4px 8px"; - spacing = mkLiteral "8px"; + "textbox" = { + padding = mkLiteral "8px 24px"; }; - "element normal urgent" = { - text-color = mkLiteral "@fg1"; + "listview" = { + lines = 10; + columns = mkLiteral "1"; + + fixed-height = false; + border = mkLiteral "1px 0 0"; + border-color = mkLiteral "@bg1"; }; - "element normal active" = { - text-color = mkLiteral "@fg1"; + "element" = { + padding = mkLiteral "8px 16px"; + spacing = mkLiteral "16px"; + background-color = mkLiteral "transparent"; }; - "element selected" = { - text-color = mkLiteral "@bg0"; #1 - background-color = mkLiteral "@fg1"; + "element normal active" = { + text-color = mkLiteral "@bg2"; }; - "element selected urgent" = { - background-color = mkLiteral "@fg1"; + "element selected normal, element selected active" = { + background-color = mkLiteral "@bg2"; + text-color = mkLiteral "@fg1"; }; "element-icon" = { - size = mkLiteral "0.8em"; + size = mkLiteral "1em"; }; "element-text" = { text-color = mkLiteral "inherit"; }; - - "scrollbar" = { - handle-width = mkLiteral "4px"; - handle-color = mkLiteral "@fg1"; - padding = mkLiteral "0 4px"; - }; }; }; }; diff --git a/modules/services/autorandr.nix b/modules/services/autorandr.nix index 74bbaf7..1825dc6 100644 --- a/modules/services/autorandr.nix +++ b/modules/services/autorandr.nix @@ -14,10 +14,10 @@ enable = true; hooks = { postswitch = { - "notify-qtile" = "qtile cmd-obj -o cmd -f restart"; + # "notify-qtile" = "qtile cmd-obj -o cmd -f restart"; # Looks to me like after restarting QTile, # the system becomes slower until picom is restarted - "restart-picom" = "systemctl restart --user picom"; + # "restart-picom" = "systemctl restart --user picom"; }; }; profiles = { diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index e691502..e17466c 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -37,7 +37,8 @@ in }; settings = with colors.scheme.doom; { # Settings global = { - monitor = 2; + monitor = 0; + follow = "keyboard"; # geometry [{width}x{height}][+/-{x}+/-{y}] # geometry = "600x50-50+65"; width = 300; -- 2.48.1