From c3f65e420f0b5b344f327aa10a3660d263ba5fd8 Mon Sep 17 00:00:00 2001 From: Andre Ramnitz Date: Fri, 16 Aug 2024 01:25:33 +0200 Subject: [PATCH] hypr: add config for hyprbars, drop rofi and sirula for fuzzel --- config/hypr/hyprland.conf | 116 ++++++-- config/hypr/scripts/gammarelay-auto-temp.py | 49 ++++ config/hypr/scripts/gammarelay-autotemp.py | 38 --- config/hypr/scripts/grimblast | 287 +++++++++++++++++++ config/hypr/scripts/grimblast-sshot-area | 4 + config/hypr/scripts/grimblast-sshot-output | 4 + config/hypr/scripts/powermenu.sh | 2 +- config/hypr/scripts/shutdown.sh | 13 - config/hypr/scripts/sleep-dpms.sh | 9 - config/hypr/scripts/sleep.sh | 7 - config/hypr/scripts/startup.sh | 111 +++---- config/hypr/scripts/terminal-color-picker.sh | 14 + config/hypr/scripts/windowswitch-rg.sh | 2 +- 13 files changed, 483 insertions(+), 173 deletions(-) create mode 100755 config/hypr/scripts/gammarelay-auto-temp.py delete mode 100755 config/hypr/scripts/gammarelay-autotemp.py create mode 100755 config/hypr/scripts/grimblast create mode 100755 config/hypr/scripts/grimblast-sshot-area create mode 100755 config/hypr/scripts/grimblast-sshot-output delete mode 100755 config/hypr/scripts/shutdown.sh delete mode 100755 config/hypr/scripts/sleep-dpms.sh delete mode 100755 config/hypr/scripts/sleep.sh create mode 100644 config/hypr/scripts/terminal-color-picker.sh diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 859bb211..0936f1fb 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -4,6 +4,8 @@ autogenerated = 0 # remove this line to remove the warning +debug:disable_logs = true # file logging. defaults to 1 for production + # See https://wiki.hyprland.org/Configuring/Monitors/ #monitor=DP-3,preferred,auto,1,vrr,2 monitor=DP-3,preferred,auto,1,vrr,2,bitdepth,10 @@ -35,16 +37,18 @@ env = MOZ_ENABLE_WAYLAND,1 # env = WLR_DRM_NO_ATOMIC,0 # set cursor -env = XCURSOR_THEME,breeze_cursors -env = XCURSOR,24 -env = HYPRCURSOR_THEME,breeze_cursors -env = HYPRCURSOR,24 +env = XCURSOR_THEME,breeze +env = XCURSOR_SIZE,24 +env = HYPRCURSOR_THEME,breeze +env = HYPRCURSOR_SIZE,24 # Execute your favorite apps at launch +exec-once = hyprpm enable hyprbars exec-once = ~/.config/hypr/scripts/startup.sh exec-once = hypridle -exec-once = openrgb --startminimized exec-once = foot -s +# exec-once = sleep 1 && openrgb --startminimized +# exec-once = sleep 1 && corectrl --minimize-systray # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf @@ -69,8 +73,8 @@ input { general { # See https://wiki.hyprland.org/Configuring/Variables/ for more - gaps_in = 12 - gaps_out = 20 + gaps_in = 6 + gaps_out = 12 border_size = 1 col.active_border = rgba(2394ccee) rgba(638cacee) 45deg col.inactive_border = rgba(aaaaaa77) rgba(33333377) 45deg @@ -85,17 +89,28 @@ general { dwindle { force_split = 2 + smart_split = false + split_width_multiplier = 1.5 } +master { + mfact = 0.50 + new_status = inherit + orientation = left + always_center_master = false + allow_small_split = false +} + + decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more - rounding = 4 + rounding = 3 blur { enabled = true size = 3 - passes = 1 + passes = 2 vibrancy = 0.1696 } @@ -157,8 +172,8 @@ group { col.border_locked_active = rgba(2e8b57ee) rgba(2e8a73ee) 45deg col.border_locked_inactive = rgba(2e8b5777) rgba(2e8a7377) 45deg groupbar { - font_family = LiterationMono Nerd Font - font_size = 12 + font_family = Iosevka Nerd Font Propo + font_size = 11 text_color = 0xff181818 gradients = true scrolling = false @@ -169,6 +184,25 @@ group { } } +plugin { + # hy3 { + # autotile = true + # trigger_width = 1610 + # } + hyprbars { + bar_text_font = Iosevka Nerd Font Propo + bar_text_size = 12 + bar_height = 24 + bar_color = rgba(2394ccbb) + # col.text = rgb(000203) + bar_part_of_window = true + bar_precedence_over_border = true + # hyprbars-button = color, size, icon, on-click + hyprbars-button = rgb(ff4040, 22, 󰖭, hyprctl dispatch killactive + hyprbars-button = rgb(eeee11, 22, 󰁌, hyprctl dispatch fullscreen 1 + } +} + # Example windowrule v1 # windowrule = float, ^(kitty)$ # Example windowrule v2 @@ -177,33 +211,50 @@ group { # more windowrules # handle steam client -windowrule = float,^(steam)$ -windowrule = float,title:^(Steam)$ -windowrule = float,title:^(Freundesliste)$ -windowrulev2 = minsize 1 1, stayfocused, float, class: ^(com.nextcloud.desktopclient.nextcloud)$ +windowrulev2 = float,class:^(steam)$ +windowrulev2 = float,title:^(Steam)$ +windowrulev2 = float,title:^(Freundesliste)$ windowrulev2 = stayfocused, title:^()$, class:^(steam)$ windowrulev2 = minsize 1 1, title:^()$, class:^(steam)$ -windowrulev2 = size 60% 100%, float, title:^(NCMPCPP.*)$ -# handle other clients +# handle wine/proton games +windowrulev2 = noanim, class:^(.*exe)$ +windowrulev2 = fullscreen, class:^(gamescope)$ + +# handle hyprbars for floating windows +windowrulev2 = plugin:hyprbars:nobar, ^floating:0 +# windowrulev2 = plugin:hyprbars:bar_color = rgba(131516aa), ^floating:1 +# windowrulev2 = plugin:hyprbars:color_text = rgba(161514aa), ^floating:1 + +# handle plasma/kde/qt apps +windowrule = float, ^(org.kde.*)$ +windowrule = float, ^(kdesystemsettings.*)$ +windowrulev2 = minsize 1 1, stayfocused, float, class: ^(com.nextcloud.desktopclient.nextcloud)$ windowrulev2 = float, size 1560 1000, pin, workspace special:overlay, class:^(org.keepassxc.KeePassXC)$ +windowrule = float, ^(lxqt-.*)$ +windowrule = float, ^(vlc.*)$ +windowrule = float, ^(pcmanfm.*)$ +windowrule = float, class:^(qalculate.*)$ + +# handle firefox +windowrulev2 = float, title:^(Über.*)$ + +# handle terminal(s/-apps) windowrulev2 = opacity 1.0 override 0.8 override, group, class:^(foot)$ windowrulev2 = float, opacity 1.0 override 0.8 override, class:^(popup)$ +windowrulev2 = size 60% 100%, float, title:^(NCMPCPP.*)$ windowrulev2 = float, noanim, stayfocused, maxsize 1280 800, center, opacity 1.0 override, class:^(kakpopup)$ +windowrule = workspace 2, ncmpcpp +windowrule = workspace 2, cava +windowrule = noinitialfocus, cava + +# handle other clients windowrule = float, ^(openrgb)$ -windowrule = float, ^(org.kde.*)$ -windowrule = float, ^(kdesystemsettings.*)$ -windowrule = float, ^(pcmanfm.*)$ -windowrule = float, ^(vlc.*)$ +windowrule = float, ^(org.corectrl.CoreCtrl)$ windowrule = float, ^(pavucontrol.*)$ -windowrule = float, class:^(qalculate.*)$ windowrulev2 = float, class:^(lutris)$ -windowrulev2 = float, title:^(Über.*)$ -# windowrule = float, ^(org.kde.okular)$ -# windowrule = float, ^(org.kde.gwenview)$ -# windowrule = float, ^(org.kde.skanlite)$ -windowrulev2 = noanim, class:^(.*exe)$ -windowrulev2 = fullscreen, class:^(gamescope)$ +windowrulev2 = float, class:^(Threema.*)$ +windowrulev2 = float, class:^(blueman-manager.*)$ # See https://wiki.hyprland.org/Configuring/Keywords/ for more $suremod = SUPER ALT CTRL @@ -214,7 +265,6 @@ bind = $suremod, M, exit, bind = $suremod, F, fullscreen,0 bind = $suremod, Return, exec, konsole # backup terminal app bind = $suremod, D, denywindowfromgroup, toggle -bind = $suremod, V, togglefloating, bind = $suremod, G, exec, ~/dotfiles/config/hypr/scripts/gamemode.sh # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more @@ -224,9 +274,11 @@ bind = $mainmod Shift, Return, exec, footclient -w 1280x800 -a popup bind = $mainmod, P, exec, footclient -w 640x400 -a popup -H hyprpicker #color Pipette bind = $mainmod, E, exec, dolphin bind = $mainmod, F, fullscreen,1 -bind = $mainmod, V, exec, killall fuzzel || cliphist list | fuzzel -d -w 100 | cliphist decode | wl-copy +bind = $mainmod, V, exec, killall fuzzel || cliphist list | fuzzel -d --config="$HOME"/.config/fuzzel/fuzzel-centered.ini | cliphist decode | wl-copy +bind = $mainmod Shift, V, togglefloating bind = $mainmod, R, exec, killall fuzzel || fuzzel -bind = $mainmod Shift, R, exec, killall rofi || rofi -show run # rofi installed for keepassxc-browser script +bind = $mainmod Shift, R, exec, killall fuzzel || fuzzel --config="$HOME"/.config/fuzzel/fuzzel-centered.ini +# bind = $mainmod Shift, R, exec, killall rofi || rofi -show run # rofi installed for keepassxc-browser script bind = $mainmod, A, pseudo, # dwindle, A for Artificial bind = $mainmod, S, swapsplit, # dwindle bind = $mainmod SHIFT, S, layoutmsg, preselect d # dwindle @@ -235,6 +287,8 @@ bind = $mainmod SHIFT, G, lockactivegroup, toggle bind = ALT, TAB, focuscurrentorlast bind = $mainmod, TAB, exec, ~/.config/hypr/scripts/windowswitch-rg.sh bind = $mainmod, grave, exec, ~/.config/hypr/scripts/RofiEmoji.sh +bind = $mainmod, plus, layoutmsg, hy3:makegroup v +bind = $mainmod, minus, layoutmsg, hy3:makegroup h # Move focus with mainMod + arrow keys bind = $mainmod, left, movefocus, l diff --git a/config/hypr/scripts/gammarelay-auto-temp.py b/config/hypr/scripts/gammarelay-auto-temp.py new file mode 100755 index 00000000..5214d9f1 --- /dev/null +++ b/config/hypr/scripts/gammarelay-auto-temp.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +"""Change screen temperature depending on dawn/dusk time.""" + +import subprocess +from datetime import datetime +from time import sleep + +def mk_time(hours, minutes, seconds=0): + """ Seconds since the beginning of day """ + return hours * 3600.0 + minutes * 60.0 + seconds + +TEMP_DAY = 6500.0 +TEMP_NIGHT = 3800.0 + +DAWN_TIME = mk_time( 6, 30) # 9:00 (Should be > WINDOW) +DUSK_TIME = mk_time(20, 40) # 19:00 (Shoulbe be > WINDOW + DAWN_TIME) +WINDOW = mk_time( 0, 15) # 15m (The time during which the temperature changes gradually until it reaches the desired value) + +temp = None + +while True: + now = datetime.now().astimezone() + current_time = mk_time(now.hour, now.minute, now.second) + + if DAWN_TIME - WINDOW < current_time < DAWN_TIME: + temp = (DAWN_TIME - current_time) * (TEMP_NIGHT - TEMP_DAY) / WINDOW + TEMP_DAY + elif DUSK_TIME - WINDOW < current_time < DUSK_TIME: + temp = (DUSK_TIME - current_time) * (TEMP_DAY - TEMP_NIGHT) / WINDOW + TEMP_NIGHT + elif current_time >= DUSK_TIME or current_time < DAWN_TIME: + temp = TEMP_NIGHT + elif current_time >= DAWN_TIME or current_time < DUSK_TIME: + temp = TEMP_DAY + + if temp: + subprocess.run( + [ + "busctl", + "--user", + "set-property", + "rs.wl-gammarelay", + "/", + "rs.wl.gammarelay", + "Temperature", + "q", + str(int(temp)), + ] + ) + + sleep(1) diff --git a/config/hypr/scripts/gammarelay-autotemp.py b/config/hypr/scripts/gammarelay-autotemp.py deleted file mode 100755 index 48958a53..00000000 --- a/config/hypr/scripts/gammarelay-autotemp.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/python - -import datetime as dt -import time -import subprocess -import os - -## Tested parameter space: -# dusk_time < 3600 + dawn_time -# 3600 < dusk_time - -with open('/tmp/autotemp.pid', 'a') as pid_file: - pid_file.write(str(os.getpid())) - -temp_day = 6500 -temp_night = 4000 -dawn_time = 6 * 3600 # 9am -dusk_time = 21 * 3600 # 19pm - -while True: - temp = temp_day - now = dt.datetime.now() - curr_time = int( - (now - now.replace(hour=0, minute=0, second=0, microsecond=0)).total_seconds() - ) - if dawn_time - 3600 < curr_time < dawn_time: - temp = (dawn_time - curr_time) * (temp_night - temp_day) / 3600 + temp_day - if dusk_time - 3600 < curr_time < dusk_time: - temp = (dusk_time - curr_time) * (temp_day - temp_night) / 3600 + temp_night - print("check") - if dusk_time < curr_time or curr_time < dawn_time: - temp = temp_night - temp = int(temp) - subprocess.run( - f"busctl --user set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q {temp}", - shell=True, - ) - time.sleep(10) diff --git a/config/hypr/scripts/grimblast b/config/hypr/scripts/grimblast new file mode 100755 index 00000000..27c37e12 --- /dev/null +++ b/config/hypr/scripts/grimblast @@ -0,0 +1,287 @@ +#!/usr/bin/env bash +## Grimblast: a helper for screenshots within hyprland +## Requirements: +## - `grim`: screenshot utility for wayland +## - `slurp`: to select an area +## - `hyprctl`: to read properties of current window (provided by Hyprland) +## - `hyprpicker`: to freeze the screen when selecting area +## - `wl-copy`: clipboard utility (provided by wl-clipboard) +## - `jq`: json utility to parse hyprctl output +## - `notify-send`: to show notifications (provided by libnotify) +## Those are needed to be installed, if unsure, run `grimblast check` +## +## See `man 1 grimblast` or `grimblast usage` for further details. + +## Author: Misterio (https://github.com/misterio77) + +## This tool is based on grimshot, with swaymsg commands replaced by their +## hyprctl equivalents. +## https://github.com/swaywm/sway/blob/master/contrib/grimshot + +# Check whether another instance is running + + +grimblastInstanceCheck="${XDG_RUNTIME_DIR:-$XDG_CACHE_DIR:-$HOME/.cache}/grimblast.lock" +if [ -e "$grimblastInstanceCheck" ]; then + exit 2 +else + touch "$grimblastInstanceCheck" +fi +trap "rm -f '$grimblastInstanceCheck'" EXIT + + +getTargetDirectory() { + test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" && + . "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" + + echo "${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}" +} + +tmp_editor_directory() { + echo "/tmp" +} + +#Detect if $GRIMBLAST_EDITOR env exist +env_editor_confirm() { + if [ -n "$GRIMBLAST_EDITOR" ]; then + echo "GRIMBLAST_EDITOR is set. Continuing..." + else + echo "GRIMBLAST_EDITOR is not set. Defaulting to gimp" + GRIMBLAST_EDITOR=gimp + fi +} + +NOTIFY=no +CURSOR= +FREEZE= +WAIT=no +SCALE= +HYPRPICKER_PID=-1 + +while [ $# -gt 0 ]; do + key="$1" + + case $key in + -n | --notify) + NOTIFY=yes + shift # past argument + ;; + -c | --cursor) + CURSOR=yes + shift # past argument + ;; + -f | --freeze) + FREEZE=yes + shift # past argument + ;; + -w | --wait) + shift + WAIT=$1 + if echo "$WAIT" | grep "[^0-9]" -q; then + echo "Invalid value for wait '$WAIT'" >&2 + exit 3 + fi + shift + ;; + -s | --scale) + shift # past argument + if [ $# -gt 0 ]; then + SCALE="$1" # assign the next argument to SCALE + shift # past argument + else + echo "Error: Missing argument for --scale option." + exit 1 + fi + ;; + *) # unknown option + break # done with parsing --flags + ;; + esac +done + +ACTION=${1:-usage} +SUBJECT=${2:-screen} +FILE=${3:-$(getTargetDirectory)/$(date -Ins).png} +FILE_EDITOR=${3:-$(tmp_editor_directory)/$(date -Ins).png} + +if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "edit" ] && [ "$ACTION" != "copysave" ] && [ "$ACTION" != "check" ]; then + echo "Usage:" + echo " grimblast [--notify] [--cursor] [--freeze] [--wait N] [--scale ] (copy|save|copysave|edit) [active|screen|output|area] [FILE|-]" + echo " grimblast check" + echo " grimblast usage" + echo "" + echo "Commands:" + echo " copy: Copy the screenshot data into the clipboard." + echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT." + echo " copysave: Combine the previous 2 options." + echo " edit: Open screenshot in the image editor of your choice (default is gimp). See man page for info." + echo " check: Verify if required tools are installed and exit." + echo " usage: Show this message and exit." + echo "" + echo "Targets:" + echo " active: Currently active window." + echo " screen: All visible outputs." + echo " output: Currently active output." + echo " area: Manually select a region or window." + exit +fi + +notify() { + notify-send -t 3000 -a grimblast "$@" +} + +notifyOk() { + [ "$NOTIFY" = "no" ] && return + + notify "$@" +} + +notifyError() { + if [ $NOTIFY = "yes" ]; then + TITLE=${2:-"Screenshot"} + MESSAGE=${1:-"Error taking screenshot with grim"} + notify -u critical "$TITLE" "$MESSAGE" + else + echo "$1" + fi +} + +resetFade() { + if [[ -n $FADELAYERS ]]; then + hyprctl keyword animation "$FADELAYERS" >/dev/null + fi +} + +killHyprpicker() { + if [ ! $HYPRPICKER_PID -eq -1 ]; then + kill $HYPRPICKER_PID + fi +} + +die() { + killHyprpicker + MSG=${1:-Bye} + notifyError "Error: $MSG" + exit 2 +} + +check() { + COMMAND=$1 + if command -v "$COMMAND" >/dev/null 2>&1; then + RESULT="OK" + else + RESULT="NOT FOUND" + fi + echo " $COMMAND: $RESULT" +} + +takeScreenshot() { + FILE=$1 + GEOM=$2 + OUTPUT=$3 + if [ -n "$OUTPUT" ]; then + grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -o "$OUTPUT" "$FILE" || die "Unable to invoke grim" + elif [ -z "$GEOM" ]; then + grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} "$FILE" || die "Unable to invoke grim" + else + grim ${CURSOR:+-c} ${SCALE:+-s "$SCALE"} -g "$GEOM" "$FILE" || die "Unable to invoke grim" + resetFade + fi +} + +wait() { + if [ "$WAIT" != "no" ]; then + sleep "$WAIT" + fi +} + +if [ "$ACTION" = "check" ]; then + echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..." + check grim + check slurp + check hyprctl + check hyprpicker + check wl-copy + check jq + check notify-send + exit +elif [ "$SUBJECT" = "active" ]; then + wait + FOCUSED=$(hyprctl activewindow -j) + GEOM=$(echo "$FOCUSED" | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"') + APP_ID=$(echo "$FOCUSED" | jq -r '.class') + WHAT="$APP_ID window" +elif [ "$SUBJECT" = "screen" ]; then + wait + GEOM="" + WHAT="Screen" +elif [ "$SUBJECT" = "output" ]; then + wait + GEOM="" + OUTPUT=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)' | jq -r '.name') + WHAT="$OUTPUT" +elif [ "$SUBJECT" = "area" ]; then + if [ "$FREEZE" = "yes" ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then + hyprpicker -r -z & + sleep 0.2 + HYPRPICKER_PID=$! + fi + + # get fade & fadeOut animation and unset it + # this removes the black border seen around screenshots + FADELAYERS="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeLayers") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')" + hyprctl keyword animation 'fadeLayers,0,1,default' >/dev/null + + WORKSPACES="$(hyprctl monitors -j | jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]')" + WINDOWS="$(hyprctl clients -j | jq -r --argjson workspaces "$WORKSPACES" 'map(select([.workspace.id] | inside($workspaces)))')" + # shellcheck disable=2086 # if we don't split, spaces mess up slurp + GEOM=$(echo "$WINDOWS" | jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp $SLURP_ARGS) + + # Check if user exited slurp without selecting the area + if [ -z "$GEOM" ]; then + killHyprpicker + resetFade + exit 1 + fi + WHAT="Area" + wait +elif [ "$SUBJECT" = "window" ]; then + die "Subject 'window' is now included in 'area'" +else + die "Unknown subject to take a screen shot from" "$SUBJECT" +fi + +if [ "$ACTION" = "copy" ]; then + takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error" + notifyOk "$WHAT copied to buffer" +elif [ "$ACTION" = "save" ]; then + if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then + TITLE="Screenshot of $SUBJECT" + MESSAGE=$(basename "$FILE") + notifyOk "$TITLE" "$MESSAGE" -i "$FILE" + echo "$FILE" + else + notifyError "Error taking screenshot with grim" + fi +elif [ "$ACTION" = "edit" ]; then + env_editor_confirm + if takeScreenshot "$FILE_EDITOR" "$GEOM" "$OUTPUT"; then + TITLE="Screenshot of $SUBJECT" + MESSAGE="Open screenshot in image editor" + notifyOk "$TITLE" "$MESSAGE" -i "$FILE_EDITOR" + $GRIMBLAST_EDITOR "$FILE_EDITOR" + echo "$FILE_EDITOR" + else + notifyError "Error taking screenshot" + fi +else + if [ "$ACTION" = "copysave" ]; then + takeScreenshot - "$GEOM" "$OUTPUT" | tee "$FILE" | wl-copy --type image/png || die "Clipboard error" + notifyOk "$WHAT copied to buffer and saved to $FILE" -i "$FILE" + echo "$FILE" + else + notifyError "Error taking screenshot with grim" + fi +fi + +killHyprpicker diff --git a/config/hypr/scripts/grimblast-sshot-area b/config/hypr/scripts/grimblast-sshot-area new file mode 100755 index 00000000..1b402f91 --- /dev/null +++ b/config/hypr/scripts/grimblast-sshot-area @@ -0,0 +1,4 @@ +#!/bin/sh + +~/dotfiles/config/hypr/scripts/grimblast save area ~/Bilder/Screenshots/scrot-area-$(date +%Y%m%d-%H%M%S).png + diff --git a/config/hypr/scripts/grimblast-sshot-output b/config/hypr/scripts/grimblast-sshot-output new file mode 100755 index 00000000..d0241f50 --- /dev/null +++ b/config/hypr/scripts/grimblast-sshot-output @@ -0,0 +1,4 @@ +#!/bin/sh + +~/dotfiles/config/hypr/scripts/grimblast save output ~/Bilder/Screenshots/scrot-output-$(date +%Y%m%d-%H%M%S).png + diff --git a/config/hypr/scripts/powermenu.sh b/config/hypr/scripts/powermenu.sh index 7e3c998d..54b995f6 100755 --- a/config/hypr/scripts/powermenu.sh +++ b/config/hypr/scripts/powermenu.sh @@ -3,7 +3,7 @@ entries="♲ Reload\n⇠ Logout\n⏾ Suspend\n⭮ Reboot\n⏻ Shutdown" -selected=$(echo -e "$entries"|fuzzel --width 20 --lines 5 --dmenu | awk '{print tolower($2)}') +selected=$(echo -e "$entries"|fuzzel --config="$HOME"/.config/fuzzel/fuzzel-powermenu.ini --dmenu | awk '{print tolower($2)}') case $selected in reload) diff --git a/config/hypr/scripts/shutdown.sh b/config/hypr/scripts/shutdown.sh deleted file mode 100755 index 8c3c5b25..00000000 --- a/config/hypr/scripts/shutdown.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -killall polkit-kde-authentication-agent-1 & -killall mako & -killall xdg-desktop-portal-hyprland & -killall xdg-desktop-portal-kde & -killall xdg-desktop-portal-gtk & -killall xdg-desktop-portal-gnome & -killall xdg-desktop-portal-wlr & -killall xdg-desktop-portal & -killall wl-gammarelay-rs & -kill "$(cat /tmp/autotemp.pid)" & - diff --git a/config/hypr/scripts/sleep-dpms.sh b/config/hypr/scripts/sleep-dpms.sh deleted file mode 100755 index 9510b520..00000000 --- a/config/hypr/scripts/sleep-dpms.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -swayidle -w timeout 600 'swaylock -f -c 000000' \ - timeout 900 'hyprctl dispatch dpms off' \ - resume 'hyprctl dispatch dpms on' \ - timeout 1800 'loginctl suspend' \ - before-sleep 'swaylock -f -c 000000' & - - diff --git a/config/hypr/scripts/sleep.sh b/config/hypr/scripts/sleep.sh deleted file mode 100755 index 9d9b0f8e..00000000 --- a/config/hypr/scripts/sleep.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -swayidle -w timeout 900 'swaylock -f -c 000000' \ - timeout 1800 'loginctl suspend' \ - before-sleep 'swaylock -f -c 000000' & - - diff --git a/config/hypr/scripts/startup.sh b/config/hypr/scripts/startup.sh index ea599f96..5e3cdf8f 100755 --- a/config/hypr/scripts/startup.sh +++ b/config/hypr/scripts/startup.sh @@ -2,24 +2,11 @@ logger '============================' logger 'HYPERLAND MAIN STARTUP BEGIN' +# shellcheck disable=SC2155 +# shellcheck disable=SC2046 +test ! -d "$XDG_RUNTIME_DIR" && export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) && logger 'xdg-runtime dir set NOW' +test ! "$DBUS_SESSION_BUS_ADDRESS" && dbus-daemon --session --address=unix:path="$XDG_RUNTIME_DIR"/bus && logger 'dbus session daemon started' -MAKOCONFIG="$HOME/.config/mako/config" - -if [[ ! -d "$XDG_RUNTIME_DIR" ]] ; then - # shellcheck disable=SC2155 - # shellcheck disable=SC2046 - export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) - logger 'xdg-runtime dir set NOW' -else - logger 'xdg-runtime dir already set' -fi - -if [[ ! "$DBUS_SESSION_BUS_ADDRESS" ]]; then - dbus-daemon --session --address=unix:path="$XDG_RUNTIME_DIR"/bus & - logger 'dbus session daemon started' -else - logger 'dbus already running' -fi if [[ ! $(pidof /usr/libexec/polkit-kde-authentication-agent-1) ]]; then if ! command -v /usr/libexec/polkit-kde-authentication-agent-1 &> /dev/null @@ -33,14 +20,7 @@ else logger 'polkit-kde already running' fi -if [[ ! $(pidof mako) ]]; -then - mako --config "${MAKOCONFIG}" & - logger 'mako started' -else - logger 'mako already running' -fi - +#------------------------------------------------------ xdg-desktop-portal killall xdg-desktop-portal-hyprland killall xdg-desktop-portal-kde killall xdg-desktop-portal-gtk @@ -68,6 +48,8 @@ if [[ ! $(pidof xdg-desktop-portal) ]]; then logger 'problem: xdg-desktop-portal not running' fi + +#------------------------------------------------------ waybar and tray apps if [[ ! $(pidof pipewire) ]]; then gentoo-pipewire-launcher & logger 'gentoo-pipewire-launcher started' @@ -76,62 +58,45 @@ else logger 'gentoo-pipewire-launcher (re-)started' fi -if [[ ! $(pidof waybar) && $(pidof pipewire) ]]; then - waybar & - logger 'waybar started' -else - until [[ $(pidof pipewire) ]]; do - sleep 0.5 - done - waybar & - logger 'waybar started with delay due to pipewire not available' -fi +until [[ $(pidof pipewire) ]]; do + sleep 0.5 +done -if [[ ! $(pidof mpd) ]]; then - mpd & - logger 'mpd started' -else - logger 'mpd already running' -fi +! pidof mpd && mpd # does fork +! pidof mpd-mpris && mpd-mpris & -if [[ ! $(pidof mpd-mpris) ]]; then - mpd-mpris & - logger 'mpd-mpris started' -else - logger 'mpd-mpris already running' -fi +! pidof waybar && waybar & +logger 'waybar started' -if [[ ! $(pidof kwalletmanager5) ]]; then - /usr/libexec/pam_kwallet_init & - logger 'kwallet5 started' -else - logger 'kwallet5 already running' -fi +until [[ $(pidof waybar) ]]; do + sleep 0.5 +done +corectrl --minimize-systray & +openrgb -p default --startminimized & -if [[ ! $(pidof swww-daemon) ]]; then - swww init > /dev/null 2>&1 & - logger 'swww-daemon started' - swww img ~/Bilder/Wallpapers/default.jpg & -fi +# MAKOCONFIG="$HOME/.config/mako/config" +# ! pidof mako && mako --config "${MAKOCONFIG}" & +! pidof swaync && swaync -if [[ ! $(pidof wl-gammarelay-rs) ]]; then - "$HOME"/.cargo/bin/wl-gammarelay-rs > /dev/null 2>&1 & - logger 'gammarelay started' -fi -if [[ ! -f "/tmp/autotemp.pid" ]]; then - kill "$(cat /tmp/autotemp.pid)" && logger "gammarelay-autotemp killed" - "$HOME"/.config/hypr/scripts/gammarelay-autotemp.py > /dev/null 2>&1 & -fi +! pidof kwalletmanager5 && /usr/libexec/pam_kwallet_init & +! pidof swww-daemon && swww-daemon > /dev/null 2>&1 & # swww-init is now deprecated +until [[ $(pidof swww-daemon) ]];do + sleep 0.5 +done +swww img ~/Bilder/Wallpapers/default.jpg # does fork -killall wl-paste & -wl-paste --type text --watch cliphist store & +! pidof wl-gammarelay-rs && "$HOME"/.cargo/bin/wl-gammarelay-rs > /dev/null 2>&1 & + +# test -f "/tmp/autotemp.pid" && kill "$(cat /tmp/autotemp.pid)" +# ~/.config/hypr/scripts/gammarelay-autotemp.py > /dev/null 2>&1 & + +pidof wl-paste && killall wl-paste +wl-paste --type text --watch cliphist store & wl-paste --type image --watch cliphist store & -logger 'clipboard manager loaded' -openrgb -p default & -logger 'openrgb default theme loaded' -kks new default & # kakoune default server +hypridle & +foot -s & -sleep 2 +sleep 0.5 logger 'HYPERLAND MAIN STARTUP END' logger '============================' diff --git a/config/hypr/scripts/terminal-color-picker.sh b/config/hypr/scripts/terminal-color-picker.sh new file mode 100644 index 00000000..8ee8ac50 --- /dev/null +++ b/config/hypr/scripts/terminal-color-picker.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the gdbus output +output=$(gdbus call --session --dest org.gnome.Shell.Screenshot --object-path /org/gnome/Shell/Screenshot --method org.gnome.Shell.Screenshot.PickColor) +colors=($(echo $output | command grep -o "[0-9\.]*")) + +# Convert to 255-based RGB format +for ((i = 0; i < ${#colors[@]}; i++)); do + colors[$i]=$(printf '%.0f' $(echo "${colors[$i]} * 255" | bc)) +done + +echo "RGB: ${colors[0]} ${colors[1]} ${colors[2]}" +printf "HEX: #%02x%02x%02x\n" "${colors[0]}" "${colors[1]}" "${colors[2]}" + diff --git a/config/hypr/scripts/windowswitch-rg.sh b/config/hypr/scripts/windowswitch-rg.sh index 8f3cf352..334d690e 100755 --- a/config/hypr/scripts/windowswitch-rg.sh +++ b/config/hypr/scripts/windowswitch-rg.sh @@ -1,5 +1,5 @@ #!/bin/bash -hyprctl clients | rg ^Window | rg -v '> :' | fuzzel --config="$HOME"/.config/fuzzel/fuzzel-wide.ini -d | awk '{print $2}' | \ +hyprctl clients | rg ^Window | rg -v '> :' | fuzzel --config="$HOME"/.config/fuzzel/fuzzel-centered.ini -d | awk '{print $2}' | \ xargs -I{} hyprctl dispatcher focuswindow "address:0x{}" -- 2.51.2