From 0fb034fa2b822131800671494f785dc7b22bb80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Fri, 1 Sep 2023 20:17:33 +0200 Subject: [PATCH] feat: removed hyprland --- flake.lock | 89 ------ flake.nix | 6 - hosts/common/core/home-manager.nix | 1 - hosts/common/core/nix.nix | 2 - hosts/common/graphical/hyprland.nix | 13 - hosts/common/graphical/wayland.nix | 8 + nix/generate-node.nix | 13 +- users/common/graphical/hyprland/default.nix | 30 -- .../graphical/hyprland/hyprland.conf.nix | 100 ------ users/common/graphical/sway/default.nix | 6 + users/common/graphical/waybar/default.nix | 59 ---- users/common/graphical/waybar/timer.py | 93 ------ users/common/graphical/waybar/waybar.css | 284 ------------------ users/patrick/default.nix | 4 +- 14 files changed, 17 insertions(+), 691 deletions(-) delete mode 100644 hosts/common/graphical/hyprland.nix create mode 100644 hosts/common/graphical/wayland.nix delete mode 100644 users/common/graphical/hyprland/default.nix delete mode 100644 users/common/graphical/hyprland/hyprland.conf.nix delete mode 100644 users/common/graphical/waybar/default.nix delete mode 100755 users/common/graphical/waybar/timer.py delete mode 100644 users/common/graphical/waybar/waybar.css diff --git a/flake.lock b/flake.lock index af90f5d..95701c8 100644 --- a/flake.lock +++ b/flake.lock @@ -227,50 +227,6 @@ "type": "github" } }, - "hyprland": { - "inputs": { - "hyprland-protocols": "hyprland-protocols", - "nixpkgs": [ - "nixpkgs" - ], - "wlroots": "wlroots", - "xdph": "xdph" - }, - "locked": { - "lastModified": 1690453540, - "narHash": "sha256-UDM0gIZcXbooKE+pTL6xAJgHhGIQxSE3XrD8bz8vv3k=", - "owner": "hyprwm", - "repo": "Hyprland", - "rev": "2ea7d10d049e26c9829912da1d16f7f35f5b265d", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "Hyprland", - "type": "github" - } - }, - "hyprland-protocols": { - "inputs": { - "nixpkgs": [ - "hyprland", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1684265364, - "narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=", - "owner": "hyprwm", - "repo": "hyprland-protocols", - "rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-protocols", - "type": "github" - } - }, "impermanence": { "locked": { "lastModified": 1684264534, @@ -404,7 +360,6 @@ "disko": "disko", "flake-utils": "flake-utils", "home-manager": "home-manager", - "hyprland": "hyprland", "impermanence": "impermanence", "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", @@ -459,50 +414,6 @@ "type": "git", "url": "https://git.lel.lol/patrick/nix-templates.git" } - }, - "wlroots": { - "flake": false, - "locked": { - "host": "gitlab.freedesktop.org", - "lastModified": 1690165843, - "narHash": "sha256-gv5kjss6REeQG0BmvK2gTx7jHLRdCnP25po6It6I6N8=", - "owner": "wlroots", - "repo": "wlroots", - "rev": "e8d545a9770a2473db32e0a0bfa757b05d2af4f3", - "type": "gitlab" - }, - "original": { - "host": "gitlab.freedesktop.org", - "owner": "wlroots", - "repo": "wlroots", - "rev": "e8d545a9770a2473db32e0a0bfa757b05d2af4f3", - "type": "gitlab" - } - }, - "xdph": { - "inputs": { - "hyprland-protocols": [ - "hyprland", - "hyprland-protocols" - ], - "nixpkgs": [ - "hyprland", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1685385764, - "narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=", - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "xdg-desktop-portal-hyprland", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b465a27..678704f 100644 --- a/flake.nix +++ b/flake.nix @@ -58,12 +58,6 @@ nixos-hardware.url = "github:nixos/nixos-hardware"; - hyprland = { - url = "github:hyprwm/Hyprland"; - #url = "/home/patrick/Downloads/Hyprland"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - devshell = { url = "github:numtide/devshell"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/common/core/home-manager.nix b/hosts/common/core/home-manager.nix index 6b6363b..8d13eb2 100644 --- a/hosts/common/core/home-manager.nix +++ b/hosts/common/core/home-manager.nix @@ -14,7 +14,6 @@ home.stateVersion = stateVersion; } inputs.impermanence.nixosModules.home-manager.impermanence - inputs.hyprland.homeManagerModules.default ]; extraSpecialArgs = { nixosConfig = config; diff --git a/hosts/common/core/nix.nix b/hosts/common/core/nix.nix index f367a3e..423cead 100644 --- a/hosts/common/core/nix.nix +++ b/hosts/common/core/nix.nix @@ -12,13 +12,11 @@ substituters = [ "https://nix-config.cachix.org" "https://nix-community.cachix.org" - "https://hyprland.cachix.org" "https://colmena.cachix.org" ]; trusted-public-keys = [ "nix-config.cachix.org-1:Vd6raEuldeIZpttVQfrUbLvXJHzzzkS0pezXCVVjDG4=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "colmena.cachix.org-1:7BzpDnjjH8ki2CT3f6GdOk7QAzPOl+1t3LvTLXqYcSg=" ]; cores = 0; diff --git a/hosts/common/graphical/hyprland.nix b/hosts/common/graphical/hyprland.nix deleted file mode 100644 index 5a8b48f..0000000 --- a/hosts/common/graphical/hyprland.nix +++ /dev/null @@ -1,13 +0,0 @@ -{pkgs, ...}: { - programs.hyprland = { - enableNvidiaPatches = true; - enable = true; - }; - services.dbus.enable = true; - xdg.portal = { - enable = true; - # we just use the hyprland desktop portal - wlr.enable = false; - extraPortals = with pkgs; [xdg-desktop-portal-hyprland]; - }; -} diff --git a/hosts/common/graphical/wayland.nix b/hosts/common/graphical/wayland.nix new file mode 100644 index 0000000..6458a54 --- /dev/null +++ b/hosts/common/graphical/wayland.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + services.dbus.enable = true; + xdg.portal = { + enable = true; + wlr.enable = false; + extraPortals = with pkgs; [xdg-desktop-portal-wlr]; + }; +} diff --git a/nix/generate-node.nix b/nix/generate-node.nix index beaed59..12fe8d9 100644 --- a/nix/generate-node.nix +++ b/nix/generate-node.nix @@ -1,15 +1,4 @@ -{ - self, - colmena, - home-manager, - impermanence, - nixos-hardware, - nixpkgs, - agenix, - agenix-rekey, - hyprland, - ... -} @ inputs: { +{self, ...} @ inputs: { name, # Additional modules to import modules ? [], diff --git a/users/common/graphical/hyprland/default.nix b/users/common/graphical/hyprland/default.nix deleted file mode 100644 index 17983bc..0000000 --- a/users/common/graphical/hyprland/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - pkgs, - lib, - ... -}: let - MOD = "SUPER"; - TAGS = map toString (lib.lists.range 41 49); -in { - imports = [../waybar]; - # This does not work currently no idea why - programs.waybar.settings.main."wlr/workspaces".persistent_workspaces = builtins.listToAttrs (map (x: { - name = x; - value = []; - }) - TAGS); - - home.packages = with pkgs; [ - qt6.qtwayland - wl-clipboard - ]; - - home.sessionVariables.NIXOS_OZONE_WL = 1; - - wayland.windowManager.hyprland = { - enable = true; - xwayland.hidpi = true; - nvidiaPatches = true; - extraConfig = import ./hyprland.conf.nix MOD TAGS pkgs; - }; -} diff --git a/users/common/graphical/hyprland/hyprland.conf.nix b/users/common/graphical/hyprland/hyprland.conf.nix deleted file mode 100644 index fcfe0c4..0000000 --- a/users/common/graphical/hyprland/hyprland.conf.nix +++ /dev/null @@ -1,100 +0,0 @@ -MOD: TAGS: pkgs: -'' - general { - gaps_in = 1 - gaps_out = 0 - no_cursor_warps = true - } - - input { - sensitivity = 0 - kb_layout = de,de - kb_variant = bone, - repeat_rate = 60 - repeat_delay = 235 - # Only change focus on mouse click - follow_mouse = 2 - float_switch_override_focus = 0 - accel_profile = flat - touchpad { - natural_scroll = true - } - } - - gestures { - workspace_swipe = true - workspace_swipe_numbered = true - } - - misc { - disable_hyprland_logo = true - mouse_move_focuses_monitor = false - } - - binds { - focus_preferred_method = 1 - } - - # keybinds - bind=${MOD},q,killactive, - bind=${MOD},return,fullscreen, - bind=${MOD},f,togglefloating - bind=${MOD},tab,cyclenext, - bind=ALT,tab,cyclenext, - bind=,Menu,exec,rofi -show drun - - bind=${MOD},left,movefocus,l - bind=${MOD},right,movefocus,r - bind=${MOD},up,movefocus,u - bind=${MOD},down,movefocus,d - - bind=${MOD},n,movefocus,l - bind=${MOD},s,movefocus,r - bind=${MOD},l,movefocus,u - bind=${MOD},r,movefocus,d - - bind=${MOD} + SHIFT,left,movewindow,l - bind=${MOD} + SHIFT,right,movewindow,r - bind=${MOD} + SHIFT,up,movewindow,u - bind=${MOD} + SHIFT,down,movewindow,d - - bindm=${MOD},mouse:272,movewindow - - bind=${MOD} + SHIFT,n,movewindow,l - bind=${MOD} + SHIFT,s,movewindow,r - bind=${MOD} + SHIFT,l,movewindow,u - bind=${MOD} + SHIFT,r,movewindow,d - - bind=${MOD},comma,workspace,-1 - bind=${MOD},period,workspace,+1 - - - - - bind=${MOD},b,exec,firefox - bind=${MOD},t,exec,kitty - bind=${MOD} + SHIFT,l,exec,systemctl suspend -i - bind=${MOD} + SHIFT,Escape,exit - #fix xwayland hidpi - exec-once = ${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 - env = GDK_SCALE,2 - env = XCURSOR_SIZE,48 - - workspace = eDP-1, 42 - - exec-once=bash -c "waybar >/tmp/waybar_error.log" - env = LIBVA_DRIVER_NAME,nvidia - env = XDG_SESSION_TYPE,wayland - env = GBM_BACKEND,nvidia-drm - env = __GLX_VENDOR_LIBRARY_NAME,nvidia - env = WLR_NO_HARDWARE_CURSORS,1 - -'' -+ builtins.concatStringsSep "\n" (map ( - x: '' - bind=${MOD},${x.fst},workspace,${x.snd} - bind=${MOD} + SHIFT,${x.fst},movetoworkspace,${x.snd} - bind=${MOD} + CTRL + SHIFT,${x.fst},movetoworkspacesilent,${x.snd} - '' - ) - (pkgs.lib.lists.zipLists (map toString (pkgs.lib.lists.range 1 9)) TAGS)) diff --git a/users/common/graphical/sway/default.nix b/users/common/graphical/sway/default.nix index e5b85b0..2560c09 100644 --- a/users/common/graphical/sway/default.nix +++ b/users/common/graphical/sway/default.nix @@ -4,6 +4,12 @@ config = { modifier = "Mod4"; terminal = "kitty"; + input = { + "*" = { + xkb_layout = "de"; + xkb_variant = "bone"; + }; + }; }; }; } diff --git a/users/common/graphical/waybar/default.nix b/users/common/graphical/waybar/default.nix deleted file mode 100644 index 22bd874..0000000 --- a/users/common/graphical/waybar/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{pkgs, ...}: { - programs.waybar = { - enable = true; - # enable workspaces - package = pkgs.waybar.overrideAttrs (prevAttrs: { - mesonFlags = prevAttrs.mesonFlags ++ ["-Dexperimental=true"]; - }); - settings = { - main = { - layer = "top"; - position = "bottom"; - modules-left = ["custom/timer" "hyprland/window"]; - modules-center = ["wlr/workspaces"]; - # wireplumber module seems to be currently broken - modules-right = ["network" "backlight" "battery" "clock" "tray"]; - - battery = { - format = "{icon} {capacity}%"; - format-icons = ["" "" "" "" "" "" "" "" ""]; - }; - - backlight = { - device = "intel_backlight"; - format = "{icon} {percent}%"; - format-icons = ["󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨"]; - on-scroll-up = "${pkgs.acpilight}/bin/xbacklight +5"; - on-scroll-down = "${pkgs.acpilight}/bin/xbacklight -5"; - }; - - clock.format = "{:%Y-%m-%d %H:%M}"; - - wireplumber = { - format = "{icon} {volume}%"; - on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - format-muted = "󰖁"; - format-icons = ["󰕿" "󰖀" "󰕾"]; - }; - - network = { - format = "{ifname}  {bandwidthUpBits}  {bandwidthDownBits}"; - interval = 1; - }; - "wlr/workspaces" = { - on-click = "activate"; - }; - - "custom/timer" = { - exec = "${pkgs.python3}/bin/python ${./timer.py}"; - on-click = "${pkgs.python3}/bin/python ${./timer.py} -s"; - on-click-right = "${pkgs.python3}/bin/python ${./timer.py} -x"; - on-scroll-up = "${pkgs.python3}/bin/python ${./timer.py} -i"; - on-scroll-down = "${pkgs.python3}/bin/python ${./timer.py} -d"; - interval = 1; - }; - }; - }; - style = ./waybar.css; - }; -} diff --git a/users/common/graphical/waybar/timer.py b/users/common/graphical/waybar/timer.py deleted file mode 100755 index 99edbc1..0000000 --- a/users/common/graphical/waybar/timer.py +++ /dev/null @@ -1,93 +0,0 @@ -#!python - -import time -import math -import os -import argparse -import subprocess -from typing import Optional - -# TODO mypy and pylint type checker - -state_file: str = "/tmp/timer_end" - -def get_timer() -> Optional[float]: - try: - with open(state_file, "r") as f: - return float(f.read()) - except: - return None - -def timer_print_remain() -> None: - end = get_timer() - if end is None: - print("Timer ") - else: - remain = end - time.time() - if remain > 60: - print(f"{math.ceil(remain/60)} min") - else: - print(f"{math.ceil(remain)} sec") - - -def timer_start(minutes: int = 20): - # If a timer exists already this function does nothing - if get_timer() is not None: - return - end: float = time.time() + minutes * 60 - timer_save(end) - -def timer_save(end: float): - with open(state_file, "w") as f: - f.write(f"{end}") - -def timer_delete(): - os.remove(state_file) - -def timer_increase(minutes: int = 5): - end = get_timer() - if end is None: - return - end += minutes *60 - timer_save(end) - -def timer_decrease(minutes: int = 5): - end = get_timer() - if end is None: - return - end -= minutes *60 - timer_save(end) - -def timer_maybe_end(): - end = get_timer() - if end is not None and end - time.time() < 0: - timer_delete() - subprocess.run(["dunstify", "-u", "critical", "Timer ended"]) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description = "Timer") - parser.add_argument("-s", "--start", action = "store_true") - parser.add_argument("-m", "--minutes", action = "store", type = int) - parser.add_argument("-i", "--increase", action = "store_true") - parser.add_argument("-d", "--decrease", action = "store_true") - parser.add_argument("-x", "--delete", action = "store_true") - args = parser.parse_args() - if args.start: - if args.minutes is None: - timer_start() - else: - timer_start(args.minutes) - if args.increase: - if args.minutes is None: - timer_increase() - else: - timer_increase(args.minutes) - if args.decrease: - if args.minutes is None: - timer_decrease() - else: - timer_decrease(args.minutes) - if args.delete: - timer_delete() - timer_maybe_end() - timer_print_remain() diff --git a/users/common/graphical/waybar/waybar.css b/users/common/graphical/waybar/waybar.css deleted file mode 100644 index 8426843..0000000 --- a/users/common/graphical/waybar/waybar.css +++ /dev/null @@ -1,284 +0,0 @@ -* { -/* `otf-font-awesome` is required to be installed for icons */ -font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; -font-size: 13px; -} - -window#waybar { - background-color: rgba(43, 48, 59, 0.5); - border-bottom: 3px solid rgba(100, 114, 125, 0.5); - color: #ffffff; - transition-property: background-color; - transition-duration: .5s; -} - -window#waybar.hidden { - opacity: 0.2; -} - -/* -window#waybar.empty { - background-color: transparent; -} -window#waybar.solo { - background-color: #FFFFFF; -} -*/ - -window#waybar.termite { - background-color: #3F3F3F; -} - -window#waybar.chromium { - background-color: #000000; - border: none; -} - -button { - /* Use box-shadow instead of border so the text isn't offset */ - box-shadow: inset 0 -3px transparent; - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; -} - -/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ -button:hover { - background: inherit; - box-shadow: inset 0 -3px #ffffff; -} - -#workspaces button { - padding: 0 5px; - background-color: transparent; - color: #ffffff; -} - -#workspaces button:hover { - background: rgba(0, 0, 0, 0.2); -} - -#workspaces button.focused { - background-color: #64727D; - box-shadow: inset 0 -3px #ffffff; -} - -#workspaces button.urgent { - background-color: #eb4d4b; -} - -#mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; -} - -#clock, -#battery, -#cpu, -#memory, -#disk, -#temperature, -#backlight, -#network, -#pulseaudio, -#wireplumber, -#custom-media, -#tray, -#mode, -#idle_inhibitor, -#scratchpad, -#mpd { - padding: 0 10px; - color: #ffffff; -} - -#window, -#workspaces { - margin: 0 4px; -} - -/* If workspaces is the leftmost module, omit left margin */ -.modules-left > widget:first-child > #workspaces { - margin-left: 0; -} - -/* If workspaces is the rightmost module, omit right margin */ -.modules-right > widget:last-child > #workspaces { - margin-right: 0; -} - -#clock { - background-color: #64727D; -} - -#battery { - background-color: #ffffff; - color: #000000; -} - -#battery.charging, #battery.plugged { - color: #ffffff; - background-color: #26A65B; -} - -@keyframes blink { - to { - background-color: #ffffff; - color: #000000; - } -} - -#battery.critical:not(.charging) { - background-color: #f53c3c; - color: #ffffff; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} - -label:focus { - background-color: #000000; -} - -#cpu { - background-color: #2ecc71; - color: #000000; -} - -#memory { - background-color: #9b59b6; -} - -#disk { - background-color: #964B00; -} - -#backlight { - background-color: #90b1b1; -} - -#network { - background-color: #2980b9; -} - -#network.disconnected { - background-color: #f53c3c; -} - -#pulseaudio { - background-color: #f1c40f; - color: #000000; -} - -#pulseaudio.muted { - background-color: #90b1b1; - color: #2a5c45; -} - -#wireplumber { - background-color: #fff0f5; - color: #000000; -} - -#wireplumber.muted { - background-color: #f53c3c; -} - -#custom-media { - background-color: #66cc99; - color: #2a5c45; - min-width: 100px; -} - -#custom-media.custom-spotify { - background-color: #66cc99; -} - -#custom-media.custom-vlc { - background-color: #ffa000; -} - -#temperature { - background-color: #f0932b; -} - -#temperature.critical { - background-color: #eb4d4b; -} - -#tray { - background-color: #2980b9; -} - -#tray > .passive { - -gtk-icon-effect: dim; -} - -#tray > .needs-attention { - -gtk-icon-effect: highlight; - background-color: #eb4d4b; -} - -#idle_inhibitor { - background-color: #2d3436; -} - -#idle_inhibitor.activated { - background-color: #ecf0f1; - color: #2d3436; -} - -#mpd { - background-color: #66cc99; - color: #2a5c45; -} - -#mpd.disconnected { - background-color: #f53c3c; -} - -#mpd.stopped { - background-color: #90b1b1; -} - -#mpd.paused { - background-color: #51a37a; -} - -#language { - background: #00b093; - color: #740864; - padding: 0 5px; - margin: 0 5px; - min-width: 16px; -} - -#keyboard-state { - background: #97e1ad; - color: #000000; - padding: 0 0px; - margin: 0 5px; - min-width: 16px; -} - -#keyboard-state > label { - padding: 0 5px; -} - -#keyboard-state > label.locked { - background: rgba(0, 0, 0, 0.2); -} - -#scratchpad { - background: rgba(0, 0, 0, 0.2); -} - -#scratchpad.empty { - background-color: transparent; -} - -#workspaces button.active { - background-color: #9c27b0; -} diff --git a/users/patrick/default.nix b/users/patrick/default.nix index 70c9dd7..63ac010 100644 --- a/users/patrick/default.nix +++ b/users/patrick/default.nix @@ -3,9 +3,9 @@ config, ... }: { - # enable nixos wide hyprland config + # enable nixos wide wayland config imports = [ - #../../hosts/common/graphical/hyprland.nix + ../../hosts/common/graphical/wayland.nix ]; users.users.patrick = {