From 70e557af91646f57685d0547b9fa7c3d9f91b0b7 Mon Sep 17 00:00:00 2001 From: victor Date: Sat, 24 Sep 2022 13:57:01 +0200 Subject: [PATCH] add do-not-disturb --- flake.lock | 12 +-- nixos/hosts/olympus/outline/configuration.nix | 14 ++-- .../hosts/thalassa/null/home/eww/default.nix | 8 +- nixos/hosts/thalassa/null/home/eww/eww.scss | 26 ++---- nixos/hosts/thalassa/null/home/eww/eww.yuck | 81 ++++++++++++++----- .../null/home/eww/scripts/do-not-disturb.sh | 10 +++ .../thalassa/null/home/eww/scripts/wifi.sh | 6 +- nixos/hosts/thalassa/null/home/hyprland.nix | 5 +- nixos/hosts/thalassa/null/home/theme.nix | 14 +++- nixos/pkgs/default.nix | 16 ++-- 10 files changed, 119 insertions(+), 73 deletions(-) create mode 100755 nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh diff --git a/flake.lock b/flake.lock index 60b584e..b7d77cc 100644 --- a/flake.lock +++ b/flake.lock @@ -400,11 +400,11 @@ "wlroots": "wlroots" }, "locked": { - "lastModified": 1663877642, - "narHash": "sha256-Hqmme1q2z0cl9RCzfCD9M2ZeZgmxrPGO0RDeIia+yvE=", + "lastModified": 1664023338, + "narHash": "sha256-S2f84PqAS75UXK0Mdf9uBn89a4UVNthA3RnSKB+sP7k=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "e5d143b2386c3773f6fb5176752a1b381d3ee7a5", + "rev": "73dbacd16d16d8a58d9c12e2a3ebcf4538faf55b", "type": "github" }, "original": { @@ -511,11 +511,11 @@ "utils": "utils_4" }, "locked": { - "lastModified": 1663823263, - "narHash": "sha256-u2glihcKP6tr8tW5Glz0pXhxOwfuRdJQGslJsg4dIFQ=", + "lastModified": 1663984587, + "narHash": "sha256-BNq/NWT74mCg5eYo1NC9K+oJ1KqwQOL+fDesyO20a3E=", "owner": "jyooru", "repo": "nix-minecraft-servers", - "rev": "51b10b3388b367dfdf8dcd7f695bdfdfc5105256", + "rev": "03e15c3aa8220c59d8b8c7454a288fc163fdf646", "type": "github" }, "original": { diff --git a/nixos/hosts/olympus/outline/configuration.nix b/nixos/hosts/olympus/outline/configuration.nix index 93e7e96..c705c2b 100644 --- a/nixos/hosts/olympus/outline/configuration.nix +++ b/nixos/hosts/olympus/outline/configuration.nix @@ -22,7 +22,7 @@ let vs = config.vault-secrets.secrets; in config.services.outline.port ]; - vault-secrets.secrets.outline = { + vault-secrets.secrets.outline = { user = config.services.outline.user; group = config.services.outline.group; }; @@ -44,12 +44,12 @@ let vs = config.vault-secrets.secrets; in region = "us-east-1"; # fake }; oidcAuthentication = { - userinfoUrl= "https://git.0x76.dev/login/oauth/userinfo"; - tokenUrl = "https://git.0x76.dev/login/oauth/access_token"; - displayName = "Gitea"; - clientId = "db58b9f0-aed1-4a60-a9bb-56077a790f5b"; - authUrl = "https://git.0x76.dev/login/oauth/authorize"; - clientSecretFile = "${vs.outline}/giteaClientSecret"; + displayName = "Keycloak"; + userinfoUrl = "https://id.0x76.dev/realms/master/protocol/openid-connect/userinfo"; + tokenUrl = "https://id.0x76.dev/realms/master/protocol/openid-connect/token"; + clientId = "outline"; + authUrl = "https://id.0x76.dev/realms/master/protocol/openid-connect/auth"; + clientSecretFile = "${vs.outline}/keycloakClientSecret"; }; }; } diff --git a/nixos/hosts/thalassa/null/home/eww/default.nix b/nixos/hosts/thalassa/null/home/eww/default.nix index 29accf2..7937e5e 100644 --- a/nixos/hosts/thalassa/null/home/eww/default.nix +++ b/nixos/hosts/thalassa/null/home/eww/default.nix @@ -9,7 +9,8 @@ home.file.".config/eww/eww.yuck".source = ./eww.yuck; home.file.".config/eww/eww.scss".text = builtins.readFile ./eww.scss; - # scripts + # scripts + # TODO: just link all scripts in ./scripts to .config/eww/scripts home.file.".config/eww/scripts/volume.sh" = { source = ./scripts/volume.sh; executable = true; @@ -29,4 +30,9 @@ source = ./scripts/workspaces.lua; executable = true; }; + + home.file.".config/eww/scripts/do-not-disturb.sh" = { + source = ./scripts/do-not-disturb.sh; + executable = true; + }; } diff --git a/nixos/hosts/thalassa/null/home/eww/eww.scss b/nixos/hosts/thalassa/null/home/eww/eww.scss index d51ad00..73435ed 100644 --- a/nixos/hosts/thalassa/null/home/eww/eww.scss +++ b/nixos/hosts/thalassa/null/home/eww/eww.scss @@ -10,11 +10,6 @@ tooltip { border-radius: 5px } -.icon { - font-family: monospace; - font-size: 1.4rem; -} - button { transition: background-color 200ms, color 200ms; } @@ -35,12 +30,6 @@ button { .bar { background-color: $mantle; - border-left: 4px dotted $red; -} - -.wifi { - font-size: 2rem; - color: $mauve; } .clock { @@ -52,29 +41,28 @@ button { margin: 0.5rem; } - .date { font-size: 1.5rem; color: $text; } -.reg-btn { - font-size: 2rem; - margin: 2px 8px; - border-radius: 10px; -} - .battery { + font-family: monospace; font-size: 1.5rem; color: $teal; } -.volume { +.volume, +.dnd, +.wifi { + font-family: monospace; font-size: 1.5rem; color: $mauve; + padding: 0 5px; } + // battery menu .batterywindow { background-color: $mantle; diff --git a/nixos/hosts/thalassa/null/home/eww/eww.yuck b/nixos/hosts/thalassa/null/home/eww/eww.yuck index 187cabf..04673af 100644 --- a/nixos/hosts/thalassa/null/home/eww/eww.yuck +++ b/nixos/hosts/thalassa/null/home/eww/eww.yuck @@ -1,12 +1,24 @@ (defwidget bar [] - (centerbox :orientation "v" :hexpand false - (box :valign "start" :hexpand false :vexpand true :orientation "v" :space-evenly false + (centerbox + :orientation "v" + (box + :valign "start" + :hexpand false + :vexpand false + :orientation "v" + :space-evenly false ) - (workspaces :halign "center" :vexpand true :hexpand false :orientation "v") + (workspaces + :halign "center" + :vexpand true + :hexpand false + :orientation "v" + ) (box :valign "end" :hexpand false :vexpand true :orientation "v" :space-evenly false (wifi) + (do-not-disturb) (volume) (battery) (time) @@ -14,23 +26,11 @@ ) ) -;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -(defpoll wifi :interval "30s" "./scripts/wifi.sh") - -(defwidget wifi [] - (box :vexpand false :hexpand false :orientation "v" - (label :text {wifi.icon} - :limit-width 10 - :tooltip {wifi.status} - :class "wifi" - ) - ) -) - ;; ━━━ BATTERY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (defwidget battery [] (eventbox :onclick "eww open batterywindow --toggle" - (label :text `${ + (label + :text `${ EWW_BATTERY.BAT0.status == "Charging" ? "" : EWW_BATTERY.BAT0.capacity < 10 ? "" : EWW_BATTERY.BAT0.capacity < 20 ? "" : @@ -42,7 +42,6 @@ EWW_BATTERY.BAT0.capacity < 80 ? "" : EWW_BATTERY.BAT0.capacity < 90 ? "" : "" }` - :limit-width 10 :class "battery" )) ) @@ -65,12 +64,47 @@ (batterymenu) ) +; ━━━ do-not-disturb ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defvar dnd "") +(defwidget do-not-disturb [] + (eventbox + :orientation "h" + :halign "center" + :space-evenly false + :onclick "nohup ./scripts/do-not-disturb.sh &" + (label + :text {dnd} + :class "dnd" + ) + ) +) + +;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defpoll wifi :interval "30s" "./scripts/wifi.sh") + +(defwidget wifi [] + (box + :orientation "h" + :halign "center" + :space-evenly false + (label + :text {wifi.icon} + :tooltip {wifi.status} + :class "wifi" + ) + ) +) + ;; ━━━ VOLUME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (defpoll volume :interval "1s" "./scripts/volume.sh") (defwidget volume [] - (eventbox :onclick "pamixer -t" - (label :text {volume.icon} - :limit-width 10 + (eventbox + :orientation "h" + :halign "center" + :space-evenly false + :onclick "pamixer -t" + (label + :text {volume.icon} :tooltip "${volume.percent}%" :class "volume" ) @@ -83,7 +117,10 @@ (defpoll dateVar :interval "600s" "date '+%A %d.%m.%y'") (defwidget time [] - (eventbox :cursor "hand" :hexpand false :vexpand false + (eventbox + :cursor "hand" + :hexpand false + :vexpand false :tooltip "${dateVar}" :onclick "eww open calendar --toggle &" (box :orientation "v" :hexpand false :vexpand false :space-evenly false :class "clock" diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh b/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh new file mode 100755 index 0000000..4926c07 --- /dev/null +++ b/nixos/hosts/thalassa/null/home/eww/scripts/do-not-disturb.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env nix-shell +#! nix-shell -p jq -i bash + +if makoctl mode | grep -Fxq "do-not-disturb"; then + eww update dnd="" + makoctl mode -r do-not-disturb > /dev/null +else + eww update dnd="" + makoctl mode -a do-not-disturb > /dev/null +fi diff --git a/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh b/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh index ced1448..fa2e537 100755 --- a/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh +++ b/nixos/hosts/thalassa/null/home/eww/scripts/wifi.sh @@ -1,15 +1,15 @@ #!/bin/sh if nmcli g | rg -q "\bconnected\b"; then - icon="󰤨" - ssid=$(nmcli -t -f name connection show --active) + icon="直" + ssid=$(nmcli -t -f name connection show --active | sed -z 's/\n/,/g;s/,$/\n/') if echo $ssid | rg -q "Wired"; then status="Connected via cable" else status="Connected to ${ssid}" fi else - icon="󰤭" + icon="睊" status="offline" fi diff --git a/nixos/hosts/thalassa/null/home/hyprland.nix b/nixos/hosts/thalassa/null/home/hyprland.nix index 5950652..da7d468 100644 --- a/nixos/hosts/thalassa/null/home/hyprland.nix +++ b/nixos/hosts/thalassa/null/home/hyprland.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: { +{ pkgs, inputs, config, ... }: { home.file.".config/hypr/hyprpaper.conf".text = '' ipc = off preload = ~/cloud/Pictures/Wallpapers-Laptop/wallpaper-nix-pink.png @@ -9,7 +9,7 @@ let startup-script = pkgs.writeScriptBin "startup" '' #!${pkgs.stdenv.shell} - hyprctl setcursor Catppuccin-Frappe-Pink-Cursors 32 + hyprctl setcursor Catppuccin-Frappe-Pink-Cursors ${builtins.toString config.home.pointerCursor.size} ${pkgs.hyprpaper}/bin/hyprpaper & ${pkgs.xsettingsd}/bin/xsettingsd & foot --server & @@ -22,6 +22,7 @@ in { enable = true; + recommendedEnvironment = true; extraConfig = '' monitor=eDP-1,1920x1080@60,0x0,1 monitor=eDP-1,addreserved,0,0,48,0 diff --git a/nixos/hosts/thalassa/null/home/theme.nix b/nixos/hosts/thalassa/null/home/theme.nix index ae23612..b19f181 100644 --- a/nixos/hosts/thalassa/null/home/theme.nix +++ b/nixos/hosts/thalassa/null/home/theme.nix @@ -1,9 +1,9 @@ -{ lib, pkgs, ... }: +{ lib, pkgs, config, ... }: let inherit (builtins) mapAttrs; theme = "Catppuccin-Pink-Dark"; - cursorTheme = "Catppuccin-Frappe-Pink-Cursors"; + cursorTheme = config.home.pointerCursor.name; colour = rec { rosewater = "f2d5cf"; flamingo = "eebebe"; @@ -41,6 +41,12 @@ in Gtk/CursorThemeName "${cursorTheme}" ''; + home.pointerCursor = { + name = "Catppuccin-Frappe-Pink-Cursors"; + size = 32; + package = pkgs.catppuccin.cursors; + }; + gtk = { enable = true; theme = { @@ -53,8 +59,8 @@ in }; cursorTheme = { name = cursorTheme; - package = pkgs.catppuccin.cursors; - size = 32; + package = config.home.pointerCursor.package; + size = config.home.pointerCursor.size; }; }; diff --git a/nixos/pkgs/default.nix b/nixos/pkgs/default.nix index 5f51e6b..a8066a4 100644 --- a/nixos/pkgs/default.nix +++ b/nixos/pkgs/default.nix @@ -1,13 +1,10 @@ final: prev: { - hedgedoc = prev.hedgedoc.overrideAttrs (old: { - # see https://github.com/NixOS/nixpkgs/issues/176127#issuecomment-1146782555 - preBuild = '' - export HOME=$TMPDIR - ''; - }); - - discord-canary = prev.discord-canary.override { withOpenASAR = true; }; - + # hedgedoc = prev.hedgedoc.overrideAttrs (old: { + # # see https://github.com/NixOS/nixpkgs/issues/176127#issuecomment-1146782555 + # preBuild = '' + # export HOME=$TMPDIR + # ''; + # }); catppuccin.cursors = prev.callPackage ./catppuccin/cursors { }; vmagent = prev.callPackage ./vmagent { }; @@ -21,6 +18,7 @@ final: prev: { withDNSCrypt = true; withTFO = true; }; + gitea-agatheme = prev.callPackage ./gitea-agatheme { }; }; }