From 85b5e29021828aa3c4642e363ed8c2819a817b0e Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Wed, 9 Apr 2025 21:11:14 +0200 Subject: [PATCH] Update hypr --- hypr/hyprland.conf | 16 ++++++----- hypr/{workspace.sh => hyprscript.sh} | 40 ++++++++++++++++++++++++++++ hypr/stat.py | 6 ++--- waybar/config | 2 +- waybar/style.css | 22 ++++++++++----- 5 files changed, 69 insertions(+), 17 deletions(-) rename hypr/{workspace.sh => hyprscript.sh} (56%) diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 338ed6f..74144de 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -53,7 +53,7 @@ workspace = 30, monitor:DP-2 $terminal = new-terminal $fileManager = dolphin $menu = rofi -show drun -theme ~/.config/rofi/theme.rasi -$hyprscript = ~/.config/dotfiles/hypr/workspace.sh +$hyprscript = ~/.config/dotfiles/hypr/hyprscript.sh ################# @@ -65,7 +65,6 @@ $hyprscript = ~/.config/dotfiles/hypr/workspace.sh # exec-once = $terminal exec-once = ~/.config/dotfiles/hypr/stat.py & -exec-once = waybar & exec-once = hyprpaper & exec-once = nm-applet & exec-once = flameshot & @@ -73,7 +72,7 @@ exec-once = blueberry-tray & exec-once = nextcloud --background & exec-once = systemctl start stream-deck --user & exec-once = systemctl start mars --user & - +exec-once = systemctl start waybar --user & ############################# ### ENVIRONMENT VARIABLES ### @@ -247,14 +246,14 @@ bind = $mainMod, A, exec, firefox bind = $mainMod SHIFT, C, killactive, bind = $mainMod, V, togglefloating, bind = $mainMod, R, exec, $menu -bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod, H, exec, $hyprscript focusnextmonitor +bind = $mainMod, J, exec, $hyprscript focusnextmonitor -bind = $mainMod SHIFT, Right, movewindow,mon:r -bind = $mainMod SHIFT, Left, movewindow,mon:l +bind = $mainMod, O, exec, $hyprscript movewindow bind = $mainMod, Tab, cyclenext bind = $mainMod SHIFT, Q, exec, hyprctl dispatch exit -bind = $mainMod CTRL, R, exec, hyprctl reload +bind = $mainMod CTRL, R, exec, $hyprscript reload bind = $mainMod, Z, exec, firefox http://jdb.localhost/todo.html https://web.telegram.org https://web.whatsapp.com/ https://discord.com/app https://nuage.polymny.studio/index.php/apps/calendar/ https://mail.infomaniak.com/2 https://mail.infomaniak.com/0 @@ -264,6 +263,9 @@ bind = $mainMod, C, exec, alacritty -e numbat bind = $mainMod, P, exec, pavucontrol bind = $mainMod, B, exec, blueberry +bind = $mainMod SHIFT, M, exec, sleep 0.5s && wtype "thomas@forgione.fr" +bind = $mainMod SHIFT, code:48, exec, sleep 0.5s && wtype "thomas@polymny.studio" + # Move focus with mainMod + arrow keys # bind = $mainMod, left, movefocus, l # bind = $mainMod, right, movefocus, r diff --git a/hypr/workspace.sh b/hypr/hyprscript.sh similarity index 56% rename from hypr/workspace.sh rename to hypr/hyprscript.sh index 80a1031..198a842 100755 --- a/hypr/workspace.sh +++ b/hypr/hyprscript.sh @@ -8,6 +8,28 @@ get_current_monitor() { hyprctl activeworkspace | head -n 1 | rev | cut -d ' ' -f 1 | rev | tr -d ':' } +get_next_monitor() { + current_monitor=$(get_current_monitor) + next_monitor=$(hyprctl monitors | grep Monitor | grep " $current_monitor " -A 2 | sed '2q;d' | cut -d ' ' -f 2) + + if [ -z $next_monitor ]; then + next_monitor=$(hyprctl monitors | grep Monitor | head -n 1 | cut -d ' ' -f 2) + fi + + echo $next_monitor +} + +get_previous_monitor() { + current_monitor=$(get_current_monitor) + previous_monitor=$(hyprctl monitors | grep Monitor | grep " $current_monitor " -B 2 | sed '2q;d' | cut -d ' ' -f 2) + + if [ -z $previous_monitor ]; then + previous_monitor=$(hyprctl monitors | grep Monitor | tail -n 1 | cut -d ' ' -f 2) + fi + + echo $previous_monitor +} + get_nth_workspace() { cat /home/thomas/.config/hypr/hyprland.conf \ | grep "^workspace =" \ @@ -19,6 +41,7 @@ get_nth_workspace() { } case "$1" in + "workspace") current_monitor=$(get_current_monitor) workspace=$(get_nth_workspace $current_monitor $2) @@ -50,4 +73,21 @@ case "$1" in fi hyprctl dispatch workspace $next_workspace;; + + "movewindow") + next_monitor=$(get_next_monitor) + hyprctl dispatch movewindow mon:$next_monitor;; + + "focuspreviousmonitor") + previous_monitor=$(get_previous_monitor) + hyprctl dispatch focusmonitor $previous_monitor;; + + "focusnextmonitor") + next_monitor=$(get_next_monitor) + hyprctl dispatch focusmonitor $next_monitor;; + + "reload") + systemctl restart waybar --user + hyprctl reload;; + esac diff --git a/hypr/stat.py b/hypr/stat.py index 933e076..0d7fcac 100755 --- a/hypr/stat.py +++ b/hypr/stat.py @@ -6,7 +6,7 @@ import psutil os.chdir(os.path.expanduser('~/.config/dotfiles/hypr')) -bars = "_▂▃▄▅▆▇███" +bars = "_▂▃▄▅▆▇█" cpu_values = [0] * 10 mem_values = [0] * 10 @@ -26,6 +26,6 @@ while True: with open('.stat.txt', 'w') as f: f.write( - ' ' + ''.join([to_bar(x) for x in cpu_values]) + '\n' + - ' ' + ''.join([to_bar(x) for x in mem_values]) + ' ' + ''.join([to_bar(x) for x in cpu_values]) + ' ' + "% 5.1f"%cpu_percent + '%\n' + + ' ' + ''.join([to_bar(x) for x in mem_values]) + ' ' + "% 5.1f"%mem_percent + '%' ) diff --git a/waybar/config b/waybar/config index fdf87d2..08e2dae 100644 --- a/waybar/config +++ b/waybar/config @@ -17,10 +17,10 @@ ], "modules-right": [ "hyprland/workspaces", - "tray", "custom/cpu", "custom/mem", "battery", + "tray", "clock", ], "hyprland/window": { diff --git a/waybar/style.css b/waybar/style.css index 0842fe2..77bb5b5 100644 --- a/waybar/style.css +++ b/waybar/style.css @@ -33,7 +33,6 @@ button { /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ button:hover { background: inherit; - box-shadow: inset 0 -3px #ffffff; } #workspaces { @@ -44,19 +43,30 @@ button:hover { #workspaces button { padding: 0px 0px; - background-color: transparent; - color: #ffffff; + background-color: white; + color: #000000; + border-radius: 50px; + border-color: transparent; + border: 1px solid; + border-color: transparent; } #workspaces button.empty { - color: #777777; + color: white; + background-color: transparent; } #workspaces button.active { - color: #ffffff; + color: black; font-weight: bold; background-color: @green; - border-radius: 50px; +} + +#workspaces button.active.empty { + font-weight: bold; + background-color: transparent; + border-color: @green; + color: @green; } #workspaces button:hover {