diff --git a/user/wm/hyprland/hyprland.nix b/user/wm/hyprland/hyprland.nix index 057f4027..8a491710 100644 --- a/user/wm/hyprland/hyprland.nix +++ b/user/wm/hyprland/hyprland.nix @@ -8,6 +8,9 @@ dmenu_command = "fuzzel -d"; inherit config lib pkgs; }) + (import ./hyprprofiles/hyprprofiles.nix { + dmenuCmd = "fuzzel -d"; inherit config lib pkgs; + }) ]; gtk.cursorTheme = { @@ -25,6 +28,7 @@ extraConfig = '' exec-once = dbus-update-activation-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY exec-once = hyprctl setcursor '' + config.gtk.cursorTheme.name + " " + builtins.toString config.gtk.cursorTheme.size + '' + exec-once = hyprprofile Personal exec-once = pypr exec-once = nm-applet @@ -202,6 +206,7 @@ bind=SUPER,I,exec,networkmanager_dmenu bind=SUPER,P,exec,keepmenu + bind=SUPERSHIFT,P,exec,hyprprofile-dmenu monitor=eDP-1,1920x1080,1000x1200,1 monitor=HDMI-A-1,1920x1200,1920x0,1 @@ -298,8 +303,12 @@ #!/bin/sh while true; do if pgrep -x .obs-wrapped > /dev/null; - then pkill -STOP fnott; - else pkill -CONT fnott; + then + pkill -STOP fnott; + emacsclient --eval "(org-yaap-mode 0)"; + else + pkill -CONT fnott; + emacsclient --eval "(if (not org-yaap-mode) (org-yaap-mode 1))"; fi sleep 10; done @@ -400,7 +409,7 @@ # width = 1280; spacing = 2; - modules-left = [ "custom/os" "battery" "backlight" "pulseaudio" "cpu" "memory" ]; + modules-left = [ "custom/os" "custom/hyprprofile" "battery" "backlight" "pulseaudio" "cpu" "memory" ]; modules-center = [ "hyprland/workspaces" ]; modules-right = [ "idle_inhibitor" "tray" "clock" ]; @@ -409,6 +418,12 @@ "exec" = ''echo "" ''; "interval" = "once"; }; + "custom/hyprprofile" = { + "format" = "  {}"; + "exec" = ''cat ~/.hyprprofile''; + "interval" = 3; + "on-click" = "hyprprofile-dmenu"; + }; "hyprland/workspaces" = { "format" = "{icon}"; "format-icons" = { @@ -518,6 +533,10 @@ border: none; } + #custom-hyprprofile { + color: #'' + config.lib.stylix.colors.base0D + ''; + } + /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ button:hover { background: inherit; diff --git a/user/wm/hyprland/hyprprofiles/hyprprofiles.nix b/user/wm/hyprland/hyprprofiles/hyprprofiles.nix new file mode 100644 index 00000000..a3ddfc23 --- /dev/null +++ b/user/wm/hyprland/hyprprofiles/hyprprofiles.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, dmenuCmd ? "rofi -dmenu", ... }: +let + dmenuScript = '' + #!/bin/sh + choice="$(\ls ~/.config/hyprprofiles | ''+dmenuCmd+'')"; + hyprprofile $choice; + ''; +in +{ + home.packages = [ + (pkgs.writeScriptBin "hyprprofile" '' + #!/bin/sh + prevprofile="$(cat ~/.hyprprofile)" + newprofile=$1 + if [ $# -eq 1 ]; then + if [ $newprofile = "Personal" ]; then + echo "" > ~/.hyprprofile; + else + echo $newprofile > ~/.hyprprofile; + fi + if [ -f ~/.config/hyprprofiles/$prevprofile/exit-hook.sh ]; then + exec ~/.config/hyprprofiles/$prevprofile/exit-hook.sh; + fi + if [ -f ~/.config/hyprprofiles/$newprofile/start-hook.sh ]; then + exec ~/.config/hyprprofiles/$newprofile/start-hook.sh; + fi + fi + '') + (pkgs.writeScriptBin "hyprprofile-dmenu" dmenuScript) + ]; + home.file.".config/hyprprofiles/" = { + source = ./profiles; + recursive = true; + executable = true; + }; +} diff --git a/user/wm/hyprland/hyprprofiles/profiles/Personal/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Personal/start-hook.sh new file mode 100755 index 00000000..723d4cad --- /dev/null +++ b/user/wm/hyprland/hyprprofiles/profiles/Personal/start-hook.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +hyprctl keyword unbind SUPER,S; +hyprctl keyword bind SUPER,S,exec,qutebrowser; diff --git a/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh new file mode 100755 index 00000000..d640f85e --- /dev/null +++ b/user/wm/hyprland/hyprprofiles/profiles/Teaching/start-hook.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +hyprctl keyword unbind SUPER,S; +hyprctl keyword bind SUPER,S,exec,container-open Teaching; +emacsclient --eval '(org-roam-switch-db "Teaching.p")' diff --git a/user/wm/hyprland/hyprprofiles/profiles/Youtube/start-hook.sh b/user/wm/hyprland/hyprprofiles/profiles/Youtube/start-hook.sh new file mode 100755 index 00000000..8419c3fa --- /dev/null +++ b/user/wm/hyprland/hyprprofiles/profiles/Youtube/start-hook.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +hyprctl keyword unbind SUPER,S; +hyprctl keyword bind SUPER,S,exec,container-open Tech; +emacsclient --eval '(org-roam-switch-db "Producer.p/LibrePhoenix.p")'