Cooler waybar

This commit is contained in:
2025-04-07 14:13:09 +02:00
parent 098905fbd8
commit 125d671421
8 changed files with 170 additions and 43 deletions

1
hypr/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.stat.txt

2
hypr/cpu.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
head -n 1 ~/.config/dotfiles/hypr/.stat.txt

View File

@@ -29,6 +29,7 @@ workspace = 16, monitor:DP-3
workspace = 17, monitor:DP-3
workspace = 18, monitor:DP-3
workspace = 19, monitor:DP-3
workspace = 20, monitor:DP-3
workspace = 21, monitor:DP-2, default:true
workspace = 22, monitor:DP-2
@@ -39,6 +40,7 @@ workspace = 26, monitor:DP-2
workspace = 27, monitor:DP-2
workspace = 28, monitor:DP-2
workspace = 29, monitor:DP-2
workspace = 30, monitor:DP-2
###################
@@ -48,9 +50,10 @@ workspace = 29, monitor:DP-2
# See https://wiki.hyprland.org/Configuring/Keywords/
# Set programs that you use
$terminal = alacritty
$terminal = new-terminal
$fileManager = dolphin
$menu = rofi -show drun -theme ~/.config/rofi/theme.rasi
$hyprscript = ~/.config/dotfiles/hypr/workspace.sh
#################
@@ -61,12 +64,15 @@ $menu = rofi -show drun -theme ~/.config/rofi/theme.rasi
# Or execute your favorite apps at launch like this:
# exec-once = $terminal
exec-once = ~/.config/dotfiles/hypr/stat.py &
exec-once = waybar &
exec-once = hyprpaper &
exec-once = nm-applet &
exec-once = flameshot &
exec-once = blueberry-tray &
exec-once = nextcloud --background &
exec-once = systemctl start stream-deck --user &
exec-once = systemctl start mars --user &
#############################
@@ -93,7 +99,7 @@ general {
border_size = 1
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
col.active_border = rgba(ffffff55)
col.active_border = rgba(ffffffaa)
col.inactive_border = rgba(ffffff22)
# Set to true enable resizing windows by clicking and dragging on borders and gaps
@@ -171,6 +177,9 @@ animations {
# windowrule = bordersize 0, floating:0, onworkspace:f[1]
# windowrule = rounding 0, floating:0, onworkspace:f[1]
# Borders only on alacritty
windowrule = noborder, class:negative:Alacritty
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
@@ -234,26 +243,26 @@ $mainMod = SUPER # Sets "Windows" key as main modifier
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, return, exec, $terminal
bind = $mainMod SHIFT, E, exec, $terminal
bind = $mainMod, A, exec, firefox
bind = $mainMod SHIFT, C, killactive,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
bind = $mainMod SHIFT, Right, movewindow,mon:r
bind = $mainMod SHIFT, Left, movewindow,mon:l
bind = $mainMod, Tab, cyclenext
bind = $mainMod SHIFT, Q, exit
bind = $mainMod SHIFT, Q, exec, hyprctl dispatch exit
bind = $mainMod CTRL, R, exec, hyprctl 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
bind = $mainMod, E, exec, firefox ext+container:name=Yuzzit&url=https://yip.atlassian.net/ ext+container:name=Yuzzit&url=https://app.slack.com/client/T03UFFGJK/D07KS0S1LDT ext+container:name=Yuzzit&url=https://app.gather.town/app/bZRkf3gh7MIximOa/ytopenspace
bind = $mainMod, E, exec, firefox "ext+container:name=Yuzzit&url=https://yip.atlassian.net/" "ext+container:name=Yuzzit&url=https://app.slack.com/client/T03UFFGJK/D07KS0S1LDT" "ext+container:name=Yuzzit&url=https://app.gather.town/app/bZRkf3gh7MIximOa/ytopenspace"
bind = $mainMod, C, exec, alacritty -e numbat
bind = $mainMod, P, exec, pavucontrol
bind = $mainMod, B, exec, blueberry
# Move focus with mainMod + arrow keys
# bind = $mainMod, left, movefocus, l
@@ -261,30 +270,35 @@ bind = $mainMod, E, exec, firefox ext+container:name=Yuzzit&url=https://yip.atla
# bind = $mainMod, up, movefocus, u
# bind = $mainMod, down, movefocus, d
bind = $mainMod, left, workspace, e-1
bind = $mainMod, right, workspace, e+1
bind = $mainMod, left, exec, $hyprscript previous
bind = $mainMod, right, exec, $hyprscript next
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, code:10, exec, hyprsome workspace 1
bind = $mainMod, code:11, exec, hyprsome workspace 2
bind = $mainMod, code:12, exec, hyprsome workspace 3
bind = $mainMod, code:13, exec, hyprsome workspace 4
bind = $mainMod, code:14, exec, hyprsome workspace 5
bind = $mainMod, code:15, exec, hyprsome workspace 6
bind = $mainMod, code:16, exec, hyprsome workspace 7
bind = $mainMod, code:17, exec, hyprsome workspace 8
bind = $mainMod, code:18, exec, hyprsome workspace 9
bind = $mainMod, code:10, exec, $hyprscript workspace 1
bind = $mainMod, code:11, exec, $hyprscript workspace 2
bind = $mainMod, code:12, exec, $hyprscript workspace 3
bind = $mainMod, code:13, exec, $hyprscript workspace 4
bind = $mainMod, code:14, exec, $hyprscript workspace 5
bind = $mainMod, code:15, exec, $hyprscript workspace 6
bind = $mainMod, code:16, exec, $hyprscript workspace 7
bind = $mainMod, code:17, exec, $hyprscript workspace 8
bind = $mainMod, code:18, exec, $hyprscript workspace 9
bind = $mainMod, code:19, exec, $hyprscript workspace 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, code:10, exec, hyprsome movefocus 1
bind = $mainMod SHIFT, code:11, exec, hyprsome movefocus 2
bind = $mainMod SHIFT, code:12, exec, hyprsome movefocus 3
bind = $mainMod SHIFT, code:13, exec, hyprsome movefocus 4
bind = $mainMod SHIFT, code:14, exec, hyprsome movefocus 5
bind = $mainMod SHIFT, code:15, exec, hyprsome movefocus 6
bind = $mainMod SHIFT, code:16, exec, hyprsome movefocus 7
bind = $mainMod SHIFT, code:17, exec, hyprsome movefocus 8
bind = $mainMod SHIFT, code:18, exec, hyprsome movefocus 9
bind = $mainMod SHIFT, code:10, exec, $hyprscript movetoworkspace 1
bind = $mainMod SHIFT, code:11, exec, $hyprscript movetoworkspace 2
bind = $mainMod SHIFT, code:12, exec, $hyprscript movetoworkspace 3
bind = $mainMod SHIFT, code:13, exec, $hyprscript movetoworkspace 4
bind = $mainMod SHIFT, code:14, exec, $hyprscript movetoworkspace 5
bind = $mainMod SHIFT, code:15, exec, $hyprscript movetoworkspace 6
bind = $mainMod SHIFT, code:16, exec, $hyprscript movetoworkspace 7
bind = $mainMod SHIFT, code:17, exec, $hyprscript movetoworkspace 8
bind = $mainMod SHIFT, code:18, exec, $hyprscript movetoworkspace 9
bind = $mainMod SHIFT, code:19, exec, $hyprscript movetoworkspace 10
# Screenshot
bind = , Print, exec, grim -g "$(slurp -d)" - | wl-copy
# Example special workspace (scratchpad)
bind = $mainMod, S, togglespecialworkspace, magic

2
hypr/mem.sh Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
tail -n 1 ~/.config/dotfiles/hypr/.stat.txt

31
hypr/stat.py Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python
import os
from os.path import expanduser
import psutil
os.chdir(os.path.expanduser('~/.config/dotfiles/hypr'))
bars = "_▂▃▄▅▆▇███"
cpu_values = [0] * 10
mem_values = [0] * 10
def to_bar(x):
return bars[round((len(bars) - 1) * x / 100)]
while True:
cpu_percent = psutil.cpu_percent(interval=2)
mem_percent = psutil.virtual_memory().percent
for i in range(len(cpu_values) - 1):
cpu_values[i] = cpu_values[i+1]
mem_values[i] = mem_values[i+1]
cpu_values[-1] = cpu_percent
mem_values[-1] = mem_percent
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])
)

53
hypr/workspace.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
get_current_workspace() {
hyprctl activeworkspace | head -n 1 | cut -d ' ' -f 3
}
get_current_monitor() {
hyprctl activeworkspace | head -n 1 | rev | cut -d ' ' -f 1 | rev | tr -d ':'
}
get_nth_workspace() {
cat /home/thomas/.config/hypr/hyprland.conf \
| grep "^workspace =" \
| grep $1 \
| sed "${2}q;d" \
| cut -d '=' -f 2 \
| cut -d ',' -f 1 \
| tr -d ' '
}
case "$1" in
"workspace")
current_monitor=$(get_current_monitor)
workspace=$(get_nth_workspace $current_monitor $2)
hyprctl dispatch workspace $workspace;;
"movetoworkspace")
current_monitor=$(get_current_monitor)
workspace=$(get_nth_workspace $current_monitor $2)
hyprctl dispatch movetoworkspace $workspace;;
"previous")
current_monitor=$(get_current_monitor)
current_workspace=$(get_current_workspace)
previous_workspace=$(($current_workspace - 1))
if [[ "$previous_workspace" == *0 ]]; then
previous_workspace=$(($previous_workspace + 10))
fi
hyprctl dispatch workspace $previous_workspace;;
"next")
current_monitor=$(get_current_monitor)
current_workspace=$(get_current_workspace)
next_workspace=$(($current_workspace + 1))
if [[ "$next_workspace" == *1 ]]; then
next_workspace=$(($next_workspace - 10))
fi
hyprctl dispatch workspace $next_workspace;;
esac