From afd8319ac702a8cf75292a62561d89ed438de706 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 29 Feb 2024 15:14:08 +0100 Subject: [PATCH] fix moving windows, add wofi --- flake.lock | 6 +- hosts/default/configuration.nix | 6 +- hosts/default/home.nix | 137 +++++++++++++++++++++++++++++--- 3 files changed, 134 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 209ec64..ced671b 100644 --- a/flake.lock +++ b/flake.lock @@ -181,11 +181,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1709109026, - "narHash": "sha256-gW1UIlzNnk9F6M04GAqF9sctGAz0CZrGlIPy7IDqAQI=", + "lastModified": 1709118025, + "narHash": "sha256-IwzgIAKHJI+qcno0pExTOfhqKgHzA5vc++gfgJ0ZCok=", "owner": "nix-community", "repo": "nixvim", - "rev": "bb9d56087dda932274e25702ce32b725295d926d", + "rev": "8bb460e261dd0fd8ac3f544f8a2a28ad64616cbe", "type": "github" }, "original": { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index d9a37b8..bc367e6 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -26,7 +26,11 @@ # Enable networking networking.networkmanager.enable = true; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings = { + # auto optimise every so often + auto-optimise-store = true; + experimental-features = ["nix-command" "flakes"]; + }; # Set your time zone. time.timeZone = "Europe/Amsterdam"; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 92c246a..f42a497 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -42,12 +42,47 @@ wl-clipboard (writeShellScriptBin "discord" '' - exec ${pkgs.discord}/bin/discord --enable-features=UseOzonePlatform --ozone-platform=wayland + exec ${discord}/bin/discord --enable-features=UseOzonePlatform --ozone-platform=wayland '') kitty - wofi pipewire lsd + (writeShellScriptBin "wofi-launch" '' + ${wofi}/bin/wofi --show drun + '') + (writeShellScriptBin "wofi-power" '' + lock="Lock" + logout="Logout" + poweroff="Poweroff" + reboot="Reboot" + sleep="Suspend" + + selected_option=$(echo -e "$lock\n$logout\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") + + if [ "$selected_option" == "$lock" ] + then + echo "lock" + swaylock + elif [ "$selected_option" == "$logout" ] + then + echo "logout" + loginctl terminate-user `whoami` + elif [ "$selected_option" == "$poweroff" ] + then + echo "poweroff" + poweroff + elif [ "$selected_option" == "$reboot" ] + then + echo "reboot" + reboot + elif [ "$selected_option" == "$sleep" ] + then + echo "sleep" + suspend + else + echo "No match" + fi + '') ]; @@ -92,6 +127,87 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; + # TODO move to seperate file + programs.wofi = { + enable = true; + settings = { + + }; + style = '' + * { + outline: none; + outline-style: none; + } + + #window { + margin: 10px; + border: none; + background-color: transparent; + border-radius: 10px; + font-family: + JetBrains Mono NF, + monospace; + font-weight: bold; + font-size: 14px; + } + + #outer-box { + margin: 10px; + border: 2px @lavender; + border-radius: 10px; + background-color: transparent; + } + + #input { + border: none; + border-radius: 10px; + margin-left: 2px; + color: @text; + outline-style: none; + background-color: @base; + } + + #scroll { + border: 10px solid @mantle; + border-radius: 10px; + /*padding-right: 10px;*/ + outline: none; + background-color: @base; + } + + #inner-box { + border: none; + border-radius: 10px; + background-color: transparent; + } + + #entry { + border: none; + /*border-radius: 10px; + margin-right: 15px; + margin-left: 15px;*/ + padding-right: 10px; + padding-left: 10px; + color: @subtext0; + background-color: @base; + } + #entry:selected { + border: none; + background-color: @green; + } + + #text:selected { + border: none; + color: @crust; + } + + #img { + background-color: transparent; + margin-right: 6px; + } + ''; + }; + # TODO move to seperate file programs.zsh = { enable=true; @@ -168,9 +284,8 @@ "custom/poweroff" = { # TODO fix format format = "P"; - # TODO make this file exist - on-click = "bash ${config.xdg.configHome}/wofi/powermenu.sh"; - on-click-right = "bash ${config.xdg.configHome}/wofi/powermenu.sh"; + on-click = "wofi-power"; + on-click-right = "swaylock"; }; "custom/pronouns" = { format = "{}"; @@ -491,17 +606,17 @@ "$mod,Return,exec,kitty" "$mod,tab,cyclenext" "SUPERSHIFT,Q,killactive" - "$mod,SPACE,exec,bash ${config.xdg.configHome}/wofi/launcher.sh" - "$mod,P,exec,bash ${config.xdg.configHome}/wofi/powermenu.sh" + "$mod,SPACE,exec,wofi-launch" + "$mod,P,exec,wofi-power" "SUPERSHIFT,m,exit" "$mod,H,movefocus,l" "$mod,J,movefocus,u" "$mod,K,movefocus,d" "$mod,L,movefocus,r" - "SUPERSHIFT,H,movefocus,l" - "SUPERSHIFT,J,movefocus,u" - "SUPERSHIFT,K,movefocus,d" - "SUPERSHIFT,L,movefocus,r" + "SUPERSHIFT,H,movewindow,l" + "SUPERSHIFT,J,movewindow,u" + "SUPERSHIFT,K,movewindow,d" + "SUPERSHIFT,L,movewindow,r" "$mod,F,togglefloating" "$mod,X,togglespecialworkspace" "SUPERSHIFT,X,movetoworkspace,special"