From 87c161788579256d21f78e80ede5b8e1da9612ca Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 29 Apr 2025 22:19:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0hyprland=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/home/hyprland/conf/hypr/hyprland.conf | 59 ++------------ .../home/hyprland/conf/hypr/keybindings.conf | 30 ++++---- .../conf/hypr/scripts/brightnesscontrol.sh | 42 ---------- .../conf/hypr/scripts/dontkillsteam.sh | 5 -- .../conf/hypr/scripts/volumecontrol.sh | 76 ------------------- modules/home/hyprland/conf/hypr/theme.conf | 25 ++---- .../home/hyprland/conf/waybar/config.jsonc | 31 +------- modules/home/xdg.nix | 7 ++ profiles/apollo/hm/default.nix | 1 + 9 files changed, 42 insertions(+), 234 deletions(-) delete mode 100755 modules/home/hyprland/conf/hypr/scripts/brightnesscontrol.sh delete mode 100755 modules/home/hyprland/conf/hypr/scripts/dontkillsteam.sh delete mode 100755 modules/home/hyprland/conf/hypr/scripts/volumecontrol.sh diff --git a/modules/home/hyprland/conf/hypr/hyprland.conf b/modules/home/hyprland/conf/hypr/hyprland.conf index e3ddc5a..f049fd0 100644 --- a/modules/home/hyprland/conf/hypr/hyprland.conf +++ b/modules/home/hyprland/conf/hypr/hyprland.conf @@ -26,39 +26,21 @@ monitor = ,preferred,auto,auto # See https://wiki.hyprland.org/Configuring/Keywords/ for more # Execute your favorite apps at launch -exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH -exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH -exec-once = /usr/lib/polkit-kde-authentication-agent-1 # authentication dialogue for GUI apps exec-once = waybar # launch the system panel exec-once = blueman-applet # systray app for BT -exec-once = nm-applet --indicator # systray app for Network/Wifi exec-once = mako # start notification demon -exec-once = wl-paste --type text --watch cliphist store # clipboard store text data -exec-once = wl-paste --type image --watch cliphist store # clipboard store image data -exec-once = ~/.config/swww/swwwallpaper.sh # start wallpaper daemon exec-once = fcitx5 -d -r +# exec-once = nm-applet --indicator # systray app for Network/Wifi +# exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH +# exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH +# exec-once = /usr/lib/polkit-kde-authentication-agent-1 # authentication dialogue for GUI apps +# exec-once = wl-paste --type text --watch cliphist store # clipboard store text data +# exec-once = wl-paste --type image --watch cliphist store # clipboard store image data +# exec-once = ~/.config/swww/swwwallpaper.sh # start wallpaper daemon #exec-once = swayidle -w timeout 900 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' # turn off monitor after 15 mins -# █▀▀ █▄░█ █░█ -# ██▄ █░▀█ ▀▄▀ - -# Some default env vars. - -# env = XDG_CURRENT_DESKTOP,Hyprland -# env = XDG_SESSION_TYPE,wayland -# env = XDG_SESSION_DESKTOP,Hyprland -# env = GDK_BACKEND,wayland -# env = QT_QPA_PLATFORM,wayland -# #env = QT_STYLE_OVERRIDE,kvantum -# env = QT_QPA_PLATFORMTHEME,qt5ct -# env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 -# env = QT_AUTO_SCREEN_SCALE_FACTOR,1 -# env = XDG_PICTURES_DIR,$HOME/Pictures - - - # █ █▄░█ █▀█ █░█ ▀█▀ # █ █░▀█ █▀▀ █▄█ ░█░ @@ -81,15 +63,6 @@ input { numlock_by_default = true } -# Example per-device config -# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more - -#device:epic mouse V1 { -# sensitivity = -0.5 -#} - -# See https://wiki.hyprland.org/Configuring/Variables/ for more - gestures { workspace_swipe = true workspace_swipe_fingers = 3 @@ -97,23 +70,6 @@ gestures { -# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ -# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ - -# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - -dwindle { - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = yes # you probably want this -} - -# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more - -#master { -# new_is_master = true -#} - - # █▀▄▀█ █ █▀ █▀▀ # █░▀░█ █ ▄█ █▄▄ @@ -139,5 +95,4 @@ source = ~/.config/hypr/theme.conf source = ~/.config/hypr/monitors.conf # initially empty, to be configured by user and remains static source = ~/.config/hypr/userprefs.conf # initially empty, to be configured by user and remains static -# Note: as userprefs.conf is sourced at the end, settings configured in this file will override the defaults diff --git a/modules/home/hyprland/conf/hypr/keybindings.conf b/modules/home/hyprland/conf/hypr/keybindings.conf index 4e6021b..7db399c 100644 --- a/modules/home/hyprland/conf/hypr/keybindings.conf +++ b/modules/home/hyprland/conf/hypr/keybindings.conf @@ -17,7 +17,7 @@ $filemanager = dolphin ################################################ # Main actions ################################################ -bind = $mainMod, C, exec, ~/.config/hypr/scripts/dontkillsteam.sh # killactive, # kill the window on focus +bind = $mainMod, C, killactive # killactive, kill the window on focus bind = $mainMod CTRL, delete, exit, # kill hyperland session bind = $mainMod, F, togglefloating, # toggle the window on focus to float bind = $mainMod CTRL, L, exec, swaylock # lock screen @@ -36,30 +36,25 @@ bind = $mainMod, V, exec, code # open vscode # Rofi is toggled on/off if you repeat the key presses bind = $mainMod, SPACE, exec, pkill rofi || rofi -show drun # launch desktop applications bind = $mainMod, tab, exec, pkill rofi || rofi -show window # switch between desktop applications -bind = $mainMod, D, exec, pkill rofi || rofi -show filebrowser # browse system files +bind = $mainMod, E, exec, pkill rofi || rofi -show filebrowser # browse system files bind = $mainMod, R, exec, pkill rofi || rofi -show run # run a command # Audio control # bind = , F10, exec, ~/.config/hypr/scripts/volumecontrol.sh -o m # toggle audio mute # binde = , F11, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d # decrease volume # binde = , F12, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i # increase volume -bind = , XF86AudioMute, exec, ~/.config/hypr/scripts/volumecontrol.sh -o m # toggle audio mute -bind = , XF86AudioMicMute, exec, ~/.config/hypr/scripts/volumecontrol.sh -i m # toggle microphone mute -binde = , XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d # decrease volume -binde = , XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i # increase volume +bind = , XF86AudioMute, exec, pamixer -t # toggle audio mute +bind = , XF86AudioMicMute, exec, pamixer --default-source -t # toggle microphone mute +binde = , XF86AudioLowerVolume, exec, pamixer -d 2# decrease volume +binde = , XF86AudioRaiseVolume, exec, pamixer -i 2# increase volume bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioPause, exec, playerctl play-pause bind = , XF86AudioNext, exec, playerctl next bind = , XF86AudioPrev, exec, playerctl previous -# Brightness control -binde = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/brightnesscontrol.sh i # increase brightness -binde = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/brightnesscontrol.sh d # decrease brightness - # Screenshot/screencapture -bind = , PRINT, exec, hyprshot -m window # logout menu -bind = ALT, PRINT, exec, hyprshot -m region # logout menu -bind = $CONTROL SHIFT, P, pass, ^(com\.obsproject\.Studio)$ # start/stop obs screen recording +bind = , PRINT, exec, hyprshot -m window +bind = ALT, PRINT, exec, hyprshot -m region ################################################ @@ -74,10 +69,13 @@ bind = $mainMod, G, exec, ~/.config/hypr/scripts/gamemode.sh # disable hypr effe ################################################ # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l +bind = $mainMod, H, movefocus, l bind = $mainMod, right, movefocus, r +bind = $mainMod, L, movefocus, r bind = $mainMod, up, movefocus, u +bind = $mainMod, K, movefocus, u bind = $mainMod, down, movefocus, d -bind = ALT, Tab, movefocus, d +bind = $mainMod, J, movefocus, d # Resize windows binde = $mainMod CONTROL, right, resizeactive, 10 0 @@ -142,5 +140,7 @@ bind = $mainMod CONTROL, S, togglespecialworkspace, # Scroll through existing workspaces with mainMod + scroll bind = $mainMod CTRL, right, workspace, e+1 bind = $mainMod, mouse_up, workspace, e+1 +bind = ALT, Tab, workspace, e+1 + bind = $mainMod CTRL, left, workspace, e-1 -bind = $mainMod, mouse_down, workspace, e-1 \ No newline at end of file +bind = $mainMod, mouse_down, workspace, e-1 diff --git a/modules/home/hyprland/conf/hypr/scripts/brightnesscontrol.sh b/modules/home/hyprland/conf/hypr/scripts/brightnesscontrol.sh deleted file mode 100755 index c0e1696..0000000 --- a/modules/home/hyprland/conf/hypr/scripts/brightnesscontrol.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce" - -function send_notification { - brightness=`brightnessctl info | grep -oP "(?<=\()\d+(?=%)" | cat` - brightinfo=$(brightnessctl info | awk -F"'" '/Device/ {print $2}') - - angle="$(((($brightness + 2) / 5) * 5))" - ico="~/.config/dunst/icons/vol/vol-${angle}.svg" - bar=$(seq -s "." $(($brightness / 15)) | sed 's/[0-9]//g') - - if [ $brightness -ne 0 ]; then - notify-send $ncolor "brightctl" -i $ico -a "$brightness$bar" "Device: $brightinfo" -r 91190 -t 800 - - else - notify-send -i $ico "Brightness: ${brightness}%" -a "$brightinfo" -u low -r 91190 -t 800 - fi - -} - -function get_brightness { - brightnessctl -m | grep -o '[0-9]\+%' | head -c-2 -} - -case $1 in -i) - # increase the backlight by 5% - brightnessctl set +5% - send_notification - ;; -d) - if [[ $(get_brightness) -lt 5 ]]; then - # avoid 0% brightness - brightnessctl set 1% - else - # decrease the backlight by 5% - brightnessctl set 5%- - fi - send_notification - ;; -esac diff --git a/modules/home/hyprland/conf/hypr/scripts/dontkillsteam.sh b/modules/home/hyprland/conf/hypr/scripts/dontkillsteam.sh deleted file mode 100755 index d162ddc..0000000 --- a/modules/home/hyprland/conf/hypr/scripts/dontkillsteam.sh +++ /dev/null @@ -1,5 +0,0 @@ -if [[ $(hyprctl activewindow -j | jq -r ".class") == "Steam" ]]; then - xdotool windowunmap $(xdotool getactivewindow) -else - hyprctl dispatch killactive "" -fi diff --git a/modules/home/hyprland/conf/hypr/scripts/volumecontrol.sh b/modules/home/hyprland/conf/hypr/scripts/volumecontrol.sh deleted file mode 100755 index ddf119a..0000000 --- a/modules/home/hyprland/conf/hypr/scripts/volumecontrol.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env sh - - -# define functions - -function print_error -{ -cat << "EOF" - ./volumecontrol.sh -[device] - ...valid device are... - i -- [i]nput decive - o -- [o]utput device - ...valid actions are... - i -- ncrease volume [+5] - d -- ecrease volume [-5] - m -- ute [x] -EOF -exit 1 -} - -function notify_vol -{ - vol=`pamixer $srce --get-volume | cat` - angle="$(( (($vol+2)/5) * 5 ))" - ico="${icodir}/vol-${angle}.svg" - bar=$(seq -s "." $(($vol / 15)) | sed 's/[0-9]//g') - notify-send $ncolor "volctl" -a "$vol$bar" "$nsink" -i $ico -r 91190 -t 800 -} - -function notify_mute -{ - mute=`pamixer $srce --get-mute | cat` - if [ "$mute" == "true" ] ; then - notify-send $ncolor "volctl" -a "muted" "$nsink" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800 - else - notify-send $ncolor "volctl" -a "unmuted" "$nsink" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800 - fi -} - - -# set device source - -while getopts io SetSrc -do - case $SetSrc in - i) nsink=$(pamixer --list-sources | grep "_input." | head -1 | awk -F '" "' '{print $NF}' | sed 's/"//') - srce="--default-source" - dvce="mic" ;; - o) nsink=$(pamixer --get-default-sink | grep "_output." | awk -F '" "' '{print $NF}' | sed 's/"//') - srce="" - dvce="speaker" ;; - esac -done - -if [ $OPTIND -eq 1 ] ; then - print_error -fi - - -# set device action - -shift $((OPTIND -1)) -step="${2:-5}" -icodir="~/.config/dunst/icons/vol" -ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce" - -case $1 in - i) pamixer $srce -i ${step} - notify_vol ;; - d) pamixer $srce -d ${step} - notify_vol ;; - m) pamixer $srce -t - notify_mute ;; - *) print_error ;; -esac - diff --git a/modules/home/hyprland/conf/hypr/theme.conf b/modules/home/hyprland/conf/hypr/theme.conf index 11a8aca..62beeb7 100644 --- a/modules/home/hyprland/conf/hypr/theme.conf +++ b/modules/home/hyprland/conf/hypr/theme.conf @@ -1,20 +1,13 @@ -exec = hyprctl setcursor Bibata-Modern-Ice 20 -exec = gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Modern-Ice' -exec = gsettings set org.gnome.desktop.interface cursor-size 20 -exec = kvantummanager --set Catppuccin-Latte -exec = gsettings set org.gnome.desktop.interface icon-theme 'Tela-circle-grey' -exec = gsettings set org.gnome.desktop.interface gtk-theme 'Catppuccin-Latte' -exec = gsettings set org.gnome.desktop.interface color-scheme 'prefer-light' +# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ +# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ -exec = gsettings set org.gnome.desktop.interface font-name 'Cantarell 10' -exec = gsettings set org.gnome.desktop.interface document-font-name 'Cantarell 10' -exec = gsettings set org.gnome.desktop.interface monospace-font-name 'CaskaydiaCove Nerd Font Mono 9' -exec = gsettings set org.gnome.desktop.interface font-antialiasing 'rgba' -exec = gsettings set org.gnome.desktop.interface font-hinting 'full' +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more -env = XCURSOR_THEME,Bibata-Modern-Ice -env = XCURSOR_SIZE,20 +dwindle { + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} general { gaps_in = 2 @@ -36,6 +29,4 @@ decoration { ignore_opacity = on xray = false } -} - -blurls = waybar +} \ No newline at end of file diff --git a/modules/home/hyprland/conf/waybar/config.jsonc b/modules/home/hyprland/conf/waybar/config.jsonc index 7bd1dee..bc78030 100644 --- a/modules/home/hyprland/conf/waybar/config.jsonc +++ b/modules/home/hyprland/conf/waybar/config.jsonc @@ -2,7 +2,7 @@ "layer": "top", "position": "top", "mod": "dock", - "height": 28, + "height": 30, "exclusive": true, "passthrough": false, "gtk-layer-shell": true, @@ -32,7 +32,6 @@ "network", "bluetooth", "wireplumber", - "wireplumber#microphone", "custom/power", "custom/rr" ], @@ -178,32 +177,10 @@ "format": "{icon} {volume}", "format-muted": "󰝟", "on-click": "pavucontrol -t 3", - "on-click-middle": "~/.config/hypr/scripts/volumecontrol.sh -o m", - "on-scroll-up": "~/.config/hypr/scripts/volumecontrol.sh -o i", - "on-scroll-down": "~/.config/hypr/scripts/volumecontrol.sh -o d", + "on-click-middle": "pamixer -t", "tooltip-format": "{icon} {desc} // {volume}%", - "scroll-step": 5, - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", ""] - } - }, - - "wireplumber#microphone": { - "format": "{format_source}", - "format-source": "", - "format-source-muted": "", - "on-click": "c -t 4", - "on-click-middle": "~/.config/hypr/scripts/volumecontrol.sh -i m", - "on-scroll-up": "~/.config/hypr/scripts/volumecontrol.sh -i i", - "on-scroll-down": "~/.config/hypr/scripts/volumecontrol.sh -i d", - "tooltip-format": "{format_source} {source_desc} // {source_volume}%", - "scroll-step": 5 + "scroll-step": 2, + "format-icons": ["", "", ""] }, // modules for padding // diff --git a/modules/home/xdg.nix b/modules/home/xdg.nix index 5f3b833..91c34a2 100644 --- a/modules/home/xdg.nix +++ b/modules/home/xdg.nix @@ -58,6 +58,13 @@ "image/jpeg" = [ "imv.desktop" ]; "image/png" = [ "imv.desktop" ]; "image/webp" = [ "imv.desktop" ]; + + "inode/directory" = [ ] + ++ (if config.xdg.enable then [ "xdg-open.desktop" ] else [ ]) + ++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ]) + ++ (if config.xdg.enable then [ "thunar.desktop" ] else [ ]) + ++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ]) + ++ (if config.xdg.enable then [ "org.gnome.Nautilus.desktop" ] else [ ]); }; associations.removed = diff --git a/profiles/apollo/hm/default.nix b/profiles/apollo/hm/default.nix index 1167947..490ee63 100644 --- a/profiles/apollo/hm/default.nix +++ b/profiles/apollo/hm/default.nix @@ -6,5 +6,6 @@ home.packages = with pkgs; [ nextcloud-client + kodi-wayland ]; }