dotfiles

My PC Dotfiles & Website
commit 4e8733df057b157ad42a91432dbb1e3c1683fcab
parent 8eae5b63132c1b387f9f1edc545c7dde499945bd
Author: maydayv7 <maydayv7@gmail.com>
Date:   Wed,  6 Mar 2024 20:06:00 +0530

feat(Hyprland): Waybar Group Drawers

Also mess with the script and border gradients

Diffstat:

MREADME.md | 2++
Mfiles/hyprland/waybar.css | 33++++++++++++++++++++++++++-------
Mflake.lock | 30+++++++++++++++---------------
Mmodules/gui/desktop/hyprland/apps/bar.nix | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mmodules/gui/desktop/hyprland/settings/default.nix | 30+++++++++++++++++++++---------
Mmodules/shell/default.nix | 4++--
Mscripts/hyprutils.nix | 64++++++++++++++++++++++++++++++++++++++++++++--------------------
Mscripts/nixos.nix | 2+-
8 files changed, 188 insertions(+), 91 deletions(-)

diff --git a/README.md b/README.md @@ -11,6 +11,8 @@ This [repository](https://github.com/maydayv7/dotfiles) contains the configurati <details> <summary>Desktop Pictures</summary> +**_Note:_** These may be outdated + | ![Hyprland](./files/images/desktop/hyprland.png) | | :----------------------------------------------: | | _Hyprland_ | diff --git a/files/hyprland/waybar.css b/files/hyprland/waybar.css @@ -17,6 +17,14 @@ window#waybar { padding-right: 5px; } +#users .drawer box { + margin-left: 5px; +} + +#custom-power { + color: @base08; +} + #waybar.empty #window { background: none; } @@ -46,8 +54,18 @@ window#waybar { border: 2px solid @base08; } +#custom-dropdown { + color: #ffffff; +} + #tray { - background-color: @base08; + color: #ffffff; + margin: 0; + padding: 0; +} + +#tray * { + margin-left: 8px; } #mpris { @@ -70,6 +88,10 @@ window#waybar { animation-direction: alternate; } +#power-profiles-daemon { + color: @base0C; +} + #custom-weather { color: @base00; background-color: @base06; @@ -88,14 +110,11 @@ window#waybar { background-color: transparent; } -#custom-power { - color: @base08; -} - #backlight, #battery, #bluetooth, #clock, +#custom-dropdown, #custom-dunst, #custom-logo, #custom-power, @@ -103,11 +122,11 @@ window#waybar { #keyboard-state, #mpris, #network, +#power-profiles-daemon, #taskbar, -#tray, #user, #window, #wireplumber, #workspaces { - padding: 0 5px 0 5px; + padding: 3px 5px 3px 5px; } diff --git a/flake.lock b/flake.lock @@ -966,11 +966,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1709208631, - "narHash": "sha256-n+SCii/GQR3zjaZzjhGAjrQQlF+xjaGEjWdpDb4wJ3U=", + "lastModified": 1709467759, + "narHash": "sha256-ojIpNROGKk56wyvpMAlBVor3CvPez3pFMORrocxW4io=", "owner": "nix-community", "repo": "lib-aggregate", - "rev": "1f03ac8dc3a54f68f55d36b5e7fc65afc302a3d7", + "rev": "206e40afdc468d0658e30e1644e2473dc6285cf2", "type": "github" }, "original": { @@ -1098,11 +1098,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1708821942, - "narHash": "sha256-jd+E1SD59qty65pwqad2mftzkT6vW5nNFWVuvayh4Zw=", + "lastModified": 1709426687, + "narHash": "sha256-jLBZmwXf0WYHzLkmEMq33bqhX55YtT5edvluFr0RcSA=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "479831ed8b3c9c7b80533999f880c7d0bf6a491b", + "rev": "7873d84a89ae6e4841528ff7f5697ddcb5bdfe6c", "type": "github" }, "original": { @@ -1209,11 +1209,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1709150264, - "narHash": "sha256-HofykKuisObPUfj0E9CJVfaMhawXkYx3G8UIFR/XQ38=", + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9099616b93301d5cf84274b184a3a5ec69e94e08", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", "type": "github" }, "original": { @@ -1277,11 +1277,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1709052491, - "narHash": "sha256-KFLBSB/2pPpKBB4g4FFD0JMQt9yZJyIItbKtQqnrnkk=", + "lastModified": 1709609172, + "narHash": "sha256-eOsB8KnWndoumWnowDPzWQd73YwxDLhGELBp9d37TK8=", "owner": "maydayv7", "repo": "proprietary", - "rev": "f3351f248f26f5fab99b0c728ae37034656a1879", + "rev": "425ac03329721d4dbe8f580fe8378eb884f6f4e9", "type": "github" }, "original": { @@ -1637,11 +1637,11 @@ "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1709212569, - "narHash": "sha256-0igtEBEmCuSspTO/HEYqFYzXuJeAy9f9BLftGih9cj4=", + "lastModified": 1709651762, + "narHash": "sha256-bqzSRKYivOsXFkiVwWfoqtBISmBrwT5ShEhXgxKrkxk=", "owner": "nix-community", "repo": "nixpkgs-wayland", - "rev": "80c30658b9c38af1fac51eb3fc6f423a1f0ae36d", + "rev": "d59914397b85d7b208b1ccc39906ef7bfcf0f26c", "type": "github" }, "original": { diff --git a/modules/gui/desktop/hyprland/apps/bar.nix b/modules/gui/desktop/hyprland/apps/bar.nix @@ -52,22 +52,18 @@ in rec { margin-bottom = 5; margin-left = 5; - modules-left = ["custom/logo" "user" "hyprland/workspaces" "hyprland/window"]; + modules-left = ["custom/logo" "group/users" "hyprland/workspaces" "hyprland/window"]; modules-center = ["wlr/taskbar"]; modules-right = [ - "tray" + "group/menu" "bluetooth" "network" - "keyboard-state" - "mpris" - "wireplumber" + "group/media" "backlight" - "battery" + "group/power" "custom/weather" "clock" - "custom/dunst" - "idle_inhibitor" - "custom/power" + "group/notify" ]; "custom/logo" = { @@ -77,6 +73,12 @@ in rec { on-click-right = "hyprctl dispatch hycov:toggleoverview"; }; + "group/users" = { + orientation = "horizontal"; + modules = ["user" "custom/power"]; + drawer.transition-left-to-right = true; + }; + user = { format = "{user}"; icon = true; @@ -85,6 +87,12 @@ in rec { open-on-click = true; }; + "custom/power" = { + format = ""; + tooltip = false; + on-click = "wlogout -p layer-shell"; + }; + "hyprland/workspaces" = { all-outputs = true; show-special = false; @@ -141,9 +149,29 @@ in rec { ]; }; - tray = { - icon-size = 14; - spacing = 8; + "group/menu" = { + orientation = "horizontal"; + modules = ["custom/dropdown" "keyboard-state" "tray"]; + drawer.transition-left-to-right = true; + }; + + "custom/dropdown" = { + format = ""; + tooltip = false; + }; + + tray.icon-size = 14; + keyboard-state = { + numlock = true; + capslock = true; + format = { + numlock = " N {icon}"; + capslock = "󰪛 {icon}"; + }; + format-icons = { + locked = ""; + unlocked = ""; + }; }; bluetooth = { @@ -168,25 +196,10 @@ in rec { on-click = "pypr show network"; }; - keyboard-state = { - numlock = true; - capslock = true; - format = { - numlock = " N {icon}"; - capslock = "󰪛 {icon}"; - }; - format-icons = { - locked = ""; - unlocked = ""; - }; - }; - - mpris = { - dynamic-len = 20; - dynamic-importance-order = ["title" "position" "length" "artist"]; - dynamic-separator = ""; - format = " {player} {dynamic}"; - format-paused = "󰏤 <i>{player}</i>"; + "group/media" = { + orientation = "horizontal"; + modules = ["wireplumber" "mpris"]; + drawer.transition-left-to-right = true; }; wireplumber = { @@ -200,6 +213,14 @@ in rec { on-click = "pypr show volume"; }; + mpris = { + dynamic-len = 20; + dynamic-importance-order = ["title" "position" "length" "artist"]; + dynamic-separator = ""; + format = " {player} {dynamic}"; + format-paused = "󰏤 <i>{player}</i>"; + }; + backlight = { format = "{icon}"; tooltip-format = "Backlight: {percent}%"; @@ -209,6 +230,12 @@ in rec { on-click = "pypr show displays"; }; + "group/power" = { + orientation = "horizontal"; + modules = ["battery" "power-profiles-daemon"]; + drawer.transition-left-to-right = true; + }; + battery = { interval = 5; align = 0; @@ -217,6 +244,7 @@ in rec { tooltip-format = "Battery: {capacity}%"; format-charging = ""; format-icons = ["" "" "" "" ""]; + on-click-right = "hyprutils toggle_fancy"; states = { good = 80; warning = 20; @@ -224,6 +252,18 @@ in rec { }; }; + power-profiles-daemon = { + format = "{icon}"; + tooltip = true; + tooltip-format = "Power Profile: {profile}"; + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; + }; + }; + "custom/weather" = { format = "{}°"; tooltip = true; @@ -260,6 +300,12 @@ in rec { }; }; + "group/notify" = { + orientation = "horizontal"; + modules = ["custom/dunst" "idle_inhibitor"]; + drawer.transition-left-to-right = true; + }; + "custom/dunst" = { tooltip = false; on-click = "dunstctl history-pop"; @@ -288,12 +334,6 @@ in rec { deactivated = ""; }; }; - - "custom/power" = { - format = ""; - tooltip = false; - on-click = "wlogout -p layer-shell"; - }; } ]; }; diff --git a/modules/gui/desktop/hyprland/settings/default.nix b/modules/gui/desktop/hyprland/settings/default.nix @@ -6,7 +6,7 @@ }: let inherit (lib) mkForce mkIf; inherit (sys.gui) fancy; - inherit (sys.lib.stylix.colors) base0A base0D; + inherit (sys.lib.stylix.colors) base03 base0A base0D; in { ## Hyprland Settings imports = util.map.modules.list ./.; @@ -82,16 +82,28 @@ in { gaps_in = 5; gaps_out = 5; border_size = 2; - "col.active_border" = mkForce "rgb(${base0A}) rgb(${base0D}) 45deg"; + "col.active_border" = mkForce "rgb(${base0D}) rgb(${base0A}) 90deg"; }; - group.groupbar = { - enabled = true; - render_titles = false; - height = 7; - scrolling = true; - "col.active" = "rgb(${base0A})"; - "col.locked_active" = "rgb(${base0D})"; + group = let + active = "rgb(${base0A}) rgb(${base0D}) 90deg"; + inactive = "rgb(${base03}) rgb(${base0D}) 90deg"; + in { + groupbar = { + enabled = true; + render_titles = false; + height = 7; + scrolling = true; + gradients = true; + "col.active" = active; + "col.locked_active" = active; + "col.inactive" = inactive; + "col.locked_inactive" = inactive; + }; + "col.border_active" = mkForce active; + "col.border_locked_active" = mkForce active; + "col.border_inactive" = mkForce inactive; + "col.border_locked_inactive" = mkForce inactive; }; animation = { diff --git a/modules/shell/default.nix b/modules/shell/default.nix @@ -9,7 +9,7 @@ with files; let inherit (util.map) modules; inherit (builtins) listToAttrs map; - inherit (lib) getExe mkEnableOption mkBefore mkIf mkMerge nameValuePair; + inherit (lib) getExe' mkEnableOption mkBefore mkIf mkMerge nameValuePair; in { imports = modules.list ./.; @@ -65,7 +65,7 @@ in { programs = listToAttrs (map (shell: nameValuePair shell - {initExtra = mkBefore ''eval $(${getExe pkgs.thefuck} --alias "fix")'';}) + {initExtra = mkBefore ''eval $(${getExe' pkgs.thefuck "thefuck"} --alias "fix")'';}) (modules.name ./.)) // { hstr.enable = true; # Command History Browser diff --git a/scripts/hyprutils.nix b/scripts/hyprutils.nix @@ -5,6 +5,21 @@ ... }: let inherit (lib) licenses recursiveUpdate; + + help = '' + # Legend # + xxx - Command[s] - Description + + # Usage # + brightness_[up,down] - Increase/Decrease screen brightness + volume_[up,down,mute] - Increase/Decrease/Mute audio + [next,prev]_track - Skip to previous/next audio track + play_pause - Toggle audio playing state + toggle_[] + media - Persist and toggle audio playing state + idle - Toggle Idle Daemon service + fancy - Toggle Compositor Effects + ''; in recursiveUpdate { meta = { @@ -37,7 +52,7 @@ in show_album_art=true show_music_in_volume_indicator=true - notify () { + notify() { notify-send -a "utility" -t 1000 -h string:x-dunst-stack-tag:"$1" "''${@:2}" } @@ -108,49 +123,43 @@ in } case "$1" in - volume_up) + "") error "Expected an Option" "${help}";; + "help") echo -e "## Hyprland Utility Script ##\n${help}";; + "volume_up") amixer set Master on amixer sset Master 5%+ volume_notification ;; - - volume_down) + "volume_down") amixer set Master on amixer sset Master 5%- volume_notification ;; - - volume_mute) + "volume_mute") amixer set Master 1+ toggle volume_notification ;; - - brightness_up) + "brightness_up") brillo -u 300000 -A 5 brightness_notification ;; - - brightness_down) + "brightness_down") brillo -u 300000 -U 5 brightness_notification ;; - - next_track) + "next_track") playerctl next sleep 0.5 && music_notification ;; - - prev_track) + "prev_track") playerctl previous sleep 0.5 && music_notification ;; - - play_pause) + "play_pause") playerctl play-pause music_notification ;; - - toggle_media) + "toggle_media") FILE="$TEMP/toggle_media" if test -f "$FILE" then @@ -164,8 +173,7 @@ in playerctl pause -a fi ;; - - toggle_idle) + "toggle_idle") if systemctl --user is-active swayidle then systemctl --user stop swayidle @@ -175,6 +183,22 @@ in notify idle -i "system-lock-screen" "Started Idle Daemon" fi ;; + "toggle_fancy") + FANCY=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') + if [ "$FANCY" = 1 ] + then + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword decoration:drop_shadow 0;\ + keyword decoration:blur:enabled 0;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + exit + fi + hyprctl reload + ;; esac ''; }) diff --git a/scripts/nixos.nix b/scripts/nixos.nix @@ -107,7 +107,7 @@ in if [[ -n $IN_NIX_SHELL ]] then - warn "You are in a Nix Developer Shell" "'nixos' may not work here properly\n" + warn "You are in a Nix Developer Shell" "This script may not work here properly\n" fi case $1 in