.config -- adds hyprland files
This commit is contained in:
21
.config/hypr/gamemode.sh
Executable file
21
.config/hypr/gamemode.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
|
||||||
|
if [ "$HYPRGAMEMODE" = 1 ] ; then
|
||||||
|
hyprctl --batch "\
|
||||||
|
keyword animations:enabled 0;\
|
||||||
|
keyword animation borderangle,0; \
|
||||||
|
keyword decoration:shadow:enabled 0;\
|
||||||
|
keyword decoration:blur:enabled 0;\
|
||||||
|
keyword decoration:fullscreen_opacity 1;\
|
||||||
|
keyword general:gaps_in 0;\
|
||||||
|
keyword general:gaps_out 0;\
|
||||||
|
keyword general:border_size 1;\
|
||||||
|
keyword decoration:rounding 0"
|
||||||
|
hyprctl notify 1 5000 "rgb(40a02b)" "Gamemode [ON]"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
hyprctl notify 1 5000 "rgb(d20f39)" "Gamemode [OFF]"
|
||||||
|
hyprctl reload
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
233
.config/hypr/hyprland.conf
Normal file
233
.config/hypr/hyprland.conf
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
# Setup monitors
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Monitors/
|
||||||
|
monitor=DP-3, 2560x1440@165, auto, 1, bitdepth, 10
|
||||||
|
|
||||||
|
exec-once = ~/.config/hypr/xdg-portal-hyprland
|
||||||
|
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
|
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
|
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||||
|
exec-once = waybar
|
||||||
|
exec-once = blueman-applet
|
||||||
|
exec-once = nm-applet --indicator
|
||||||
|
# exec-once = steam
|
||||||
|
# exec-once = equibop
|
||||||
|
# exec-once = ayugram
|
||||||
|
exec = swaybg -m fill -i ~/.config/hypr/moon-over-mondstat.jpg
|
||||||
|
exec = swaync
|
||||||
|
exec = wl-gammarelay
|
||||||
|
|
||||||
|
input {
|
||||||
|
kb_layout = br
|
||||||
|
kb_variant = abnt2
|
||||||
|
kb_options = caps:swapescape
|
||||||
|
|
||||||
|
repeat_rate = 50
|
||||||
|
repeat_delay = 300
|
||||||
|
|
||||||
|
follow_mouse = false
|
||||||
|
|
||||||
|
sensitivity = 0
|
||||||
|
|
||||||
|
accel_profile = flat
|
||||||
|
|
||||||
|
touchpad {
|
||||||
|
natural_scroll = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
general {
|
||||||
|
gaps_in = 5
|
||||||
|
# gaps_out = 20
|
||||||
|
gaps_out = 10
|
||||||
|
border_size = 2
|
||||||
|
# border_size = 1
|
||||||
|
# col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
|
||||||
|
# col.active_border= rgb(cdd6f4)
|
||||||
|
# col.inactive_border = rgba(595959aa)
|
||||||
|
|
||||||
|
resize_on_border = true
|
||||||
|
|
||||||
|
allow_tearing = true
|
||||||
|
|
||||||
|
layout = dwindle
|
||||||
|
}
|
||||||
|
|
||||||
|
misc {
|
||||||
|
disable_hyprland_logo = yes
|
||||||
|
}
|
||||||
|
|
||||||
|
decoration {
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||||
|
|
||||||
|
rounding = 10
|
||||||
|
|
||||||
|
blur {
|
||||||
|
enabled = true
|
||||||
|
size = 3
|
||||||
|
passes = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
shadow {
|
||||||
|
enabled = true
|
||||||
|
range = 4
|
||||||
|
render_power = 3
|
||||||
|
color = rgba(1a1a1aee)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
animations {
|
||||||
|
enabled = yes
|
||||||
|
|
||||||
|
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
||||||
|
|
||||||
|
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
|
||||||
|
|
||||||
|
animation = windows, 1, 7, myBezier
|
||||||
|
animation = windowsOut, 1, 7, default, popin 80%
|
||||||
|
animation = border, 1, 10, default
|
||||||
|
animation = fade, 1, 7, default
|
||||||
|
animation = workspaces, 1, 6, default
|
||||||
|
}
|
||||||
|
|
||||||
|
dwindle {
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
|
||||||
|
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
|
||||||
|
preserve_split = yes # you probably want this
|
||||||
|
}
|
||||||
|
|
||||||
|
master {
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
||||||
|
new_status = true
|
||||||
|
}
|
||||||
|
|
||||||
|
# gestures {
|
||||||
|
# # See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||||
|
# workspace_swipe = true
|
||||||
|
# workspace_swipe_min_fingers = true
|
||||||
|
# }
|
||||||
|
gesture = 3, horizontal, workspace
|
||||||
|
|
||||||
|
binds {
|
||||||
|
allow_workspace_cycles = true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Example windowrule v1
|
||||||
|
# windowrulev2 = float, class:^(kitty)$
|
||||||
|
# Example windowrule v2
|
||||||
|
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||||
|
# rules below would make the specific app transparent
|
||||||
|
|
||||||
|
|
||||||
|
# previous windowrule (i have no idea why it caused issues to keep them as v1)
|
||||||
|
# windowrulev2 = float, class:^(pavucontrol)$
|
||||||
|
# windowrulev2 = float, class:^(nm-connection-editor)$
|
||||||
|
# windowrulev2 = float, class:^(chromium)$
|
||||||
|
# windowrulev2 = float, class:^(thunar)$
|
||||||
|
# windowrulev2 = float, title:^(btop)$
|
||||||
|
# windowrulev2 = opacity 0.95 0.6, class:^(kitty)$
|
||||||
|
# windowrulev2 = animation popin, class:^(kitty)$, title:^(Aggiornamenti)$
|
||||||
|
# windowrulev2 = animation popin, class:^(thunar)$
|
||||||
|
# windowrulev2 = opacity 0.95 0.8, class:^(thunar)$
|
||||||
|
# windowrulev2 = opacity 0.95 0.8, class:^(VSCodium)$
|
||||||
|
# windowrulev2 = opacity 0.95 0.6, animation popin, class:^(Chromium)$
|
||||||
|
windowrulev2 = move cursor -3% -105%, class:^(rofi)$
|
||||||
|
windowrulev2 = noanim, class:^(rofi)$
|
||||||
|
windowrulev2 = opacity 0.95 0.8, class:^(rofi)$
|
||||||
|
|
||||||
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
|
$mainMod = SUPER
|
||||||
|
|
||||||
|
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
|
||||||
|
bind = $mainMod, Q, exec, alacritty # Open the terminal
|
||||||
|
bind = $mainMod, W, killactive, # Close the active window
|
||||||
|
bind = $mainMod ALT, L, exec, swaylock # Lock the screen
|
||||||
|
bind = $mainMod ALT, K, exec, wlogout -b 6 -T 400 -B 400 --protocol layer-shell # Show the logout window
|
||||||
|
bind = $mainMod SHIFT, M, exit, # Exit Hyprland all together no (force quit Hyprland)
|
||||||
|
bind = $mainMod, V, togglefloating, # Allow a window to float
|
||||||
|
bind = $mainMod, R, exec, rofi -show drun # Show the graphicall app launcher
|
||||||
|
bind = $mainMod, P, pseudo, # Toggle pseudo-split
|
||||||
|
bind = $mainMod, J, togglesplit, # Toggle split
|
||||||
|
# bind = $mainMod, S, exec, grim -g "$(slurp)" - | swappy -f -# Take a screenshot
|
||||||
|
bind = $mainMod, S, exec, grimblast --freeze copysave area /media/hd/clouds/nextcloud-pudim/home/pictures/screenshots/$(date +%Y-%m-%d_%H-%m-%s).png - # Take a screenshot
|
||||||
|
# bind = $mainMod SHIFT, B, exec, ~/.config/waybar/scripts/launch.sh # Reload waybar
|
||||||
|
bind = $mainMod SHIFT, B, exec, ~/.config/waybar/scripts/reload-waybar.sh # Reload waybar
|
||||||
|
bind = $mainMod SHIFT, N, exec, hyprctl reload # Reload waybar
|
||||||
|
bind = $mainMod, F, fullscreen
|
||||||
|
|
||||||
|
# Changing Screen Temperature with wl-gammarelay
|
||||||
|
bind= $mainMod CTRL, 0, exec,busctl --user -- set-property rs.wl-gammarelay / rs.wl.gammarelay Temperature q 6500
|
||||||
|
bind= $mainMod CTRL, Down, exec,busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n -500
|
||||||
|
bind= $mainMod CTRL, Up, exec,busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n +500
|
||||||
|
|
||||||
|
# Move focus with mainMod + arrow keys
|
||||||
|
bind = $mainMod, left, movefocus, l
|
||||||
|
bind = $mainMod, right, movefocus, r
|
||||||
|
bind = $mainMod, up, movefocus, u
|
||||||
|
bind = $mainMod, down, movefocus, d
|
||||||
|
|
||||||
|
# Move focus with mainMod + VIM motions
|
||||||
|
unbind = $mainMod, J
|
||||||
|
unbind = $mainMod, K
|
||||||
|
bind = $mainMod, h, movefocus, l
|
||||||
|
bind = $mainMod, l, movefocus, r
|
||||||
|
bind = $mainMod, j, movefocus, d
|
||||||
|
bind = $mainMod, k, movefocus, u
|
||||||
|
|
||||||
|
# Switch workspaces with mainMod + [0-9]
|
||||||
|
bind = $mainMod, 1, workspace, 1
|
||||||
|
bind = $mainMod, 2, workspace, 2
|
||||||
|
bind = $mainMod, 3, workspace, 3
|
||||||
|
bind = $mainMod, 4, workspace, 4
|
||||||
|
bind = $mainMod, 5, workspace, 5
|
||||||
|
bind = $mainMod, 6, workspace, 6
|
||||||
|
bind = $mainMod, 7, workspace, 7
|
||||||
|
bind = $mainMod, 8, workspace, 8
|
||||||
|
bind = $mainMod, 9, workspace, 9
|
||||||
|
bind = $mainMod, 0, workspace, 10
|
||||||
|
|
||||||
|
# Move active window to a workspace on the left or on the right of the current workspace
|
||||||
|
bind = $mainMod SHIFT, right, movetoworkspace, +1
|
||||||
|
bind = $mainMod SHIFT, left, movetoworkspace, -1
|
||||||
|
|
||||||
|
unbind = $mainMod SHIFT, J
|
||||||
|
unbind = $mainMod SHIFT, K
|
||||||
|
bind = $mainMod SHIFT, h, movetoworkspace, -1
|
||||||
|
bind = $mainMod SHIFT, l, movetoworkspace, +1
|
||||||
|
|
||||||
|
# Switch current workspace to the workspace on the left or on the right of the current workspace
|
||||||
|
bind = CTRL ALT, right, workspace, +1
|
||||||
|
bind = CTRL ALT, left, workspace, -1
|
||||||
|
|
||||||
|
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
||||||
|
bind = $mainMod SHIFT, 1, movetoworkspace, 1
|
||||||
|
bind = $mainMod SHIFT, 2, movetoworkspace, 2
|
||||||
|
bind = $mainMod SHIFT, 3, movetoworkspace, 3
|
||||||
|
bind = $mainMod SHIFT, 4, movetoworkspace, 4
|
||||||
|
bind = $mainMod SHIFT, 5, movetoworkspace, 5
|
||||||
|
bind = $mainMod SHIFT, 6, movetoworkspace, 6
|
||||||
|
bind = $mainMod SHIFT, 7, movetoworkspace, 7
|
||||||
|
bind = $mainMod SHIFT, 8, movetoworkspace, 8
|
||||||
|
bind = $mainMod SHIFT, 9, movetoworkspace, 9
|
||||||
|
bind = $mainMod SHIFT, 0, movetoworkspace, 10
|
||||||
|
|
||||||
|
# Example special workspace (scratchpad)
|
||||||
|
bind = $mainMod, S, togglespecialworkspace, magic
|
||||||
|
bind = $mainMod SHIFT, S, movetoworkspace, special:magic
|
||||||
|
|
||||||
|
# Scroll through existing workspaces with mainMod + scroll
|
||||||
|
bind = $mainMod, mouse_down, workspace, +1
|
||||||
|
bind = $mainMod, mouse_up, workspace, -1
|
||||||
|
|
||||||
|
# Customs
|
||||||
|
|
||||||
|
bind = WIN, F1, exec, ~/.config/hypr/gamemode.sh
|
||||||
|
bind = $mainMod SHIFT, B, exec, ~/.config/waybar/scripts/launch.sh
|
||||||
|
|
||||||
|
# Move/resize windows with mainMod + LMB/RMB and dragging
|
||||||
|
bindm = $mainMod, mouse:272, movewindow
|
||||||
|
bindm = $mainMod, mouse:273, resizewindow
|
||||||
|
|
||||||
|
windowrule = suppressevent maximize, class:.*
|
||||||
BIN
.config/hypr/moon-over-mondstat.jpg
Normal file
BIN
.config/hypr/moon-over-mondstat.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 MiB |
BIN
.config/hypr/sayu-without-char.jpg
Normal file
BIN
.config/hypr/sayu-without-char.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 801 KiB |
BIN
.config/hypr/sucrose.jpg
Normal file
BIN
.config/hypr/sucrose.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 643 KiB |
8
.config/hypr/xdg-portal-hyprland
Executable file
8
.config/hypr/xdg-portal-hyprland
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sleep 1
|
||||||
|
killall xdg-desktop-portal-hyprland
|
||||||
|
killall xdg-desktop-portal-wlr
|
||||||
|
killall xdg-desktop-portal
|
||||||
|
/usr/lib/xdg-desktop-portal-hyprland &
|
||||||
|
sleep 2
|
||||||
|
/usr/lib/xdg-desktop-portal &
|
||||||
BIN
.config/hypr/xiao.jpg
Normal file
BIN
.config/hypr/xiao.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 856 KiB |
31
.config/waybar/config.jsonc
Normal file
31
.config/waybar/config.jsonc
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"layer": "top",
|
||||||
|
"position": "top",
|
||||||
|
"mod": "dock",
|
||||||
|
"exclusive": true,
|
||||||
|
"passthrough": false,
|
||||||
|
"gtk-layer-shell": true,
|
||||||
|
"include": [
|
||||||
|
"~/.config/waybar/modules.jsonc"
|
||||||
|
],
|
||||||
|
"modules-left": [
|
||||||
|
"custom/media",
|
||||||
|
"hyprland/window"
|
||||||
|
],
|
||||||
|
"modules-center": [
|
||||||
|
"clock",
|
||||||
|
"tray",
|
||||||
|
"custom/swaync"
|
||||||
|
],
|
||||||
|
"modules-right": [
|
||||||
|
"hyprland/workspaces"
|
||||||
|
],
|
||||||
|
// Group Hardware
|
||||||
|
"group/hardware": {
|
||||||
|
"orientation": "horizontal",
|
||||||
|
"modules": [
|
||||||
|
"custom/wl-gammarelay-temperature",
|
||||||
|
"backlight"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
187
.config/waybar/modules.jsonc
Normal file
187
.config/waybar/modules.jsonc
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
{
|
||||||
|
"hyprland/window": {
|
||||||
|
"format": "{}",
|
||||||
|
"rewrite": {
|
||||||
|
"(.*) - Chromium": " $1",
|
||||||
|
"(.*) - Discord": " $1",
|
||||||
|
"(.*) - Thunar": " $1",
|
||||||
|
"Alacritty": " Alacritty",
|
||||||
|
"AyuGram": " Telegram",
|
||||||
|
"Steam": " Steam",
|
||||||
|
"WhatsDesk": " WhatsDesk",
|
||||||
|
"class<equibop>": " $1"
|
||||||
|
},
|
||||||
|
"icon": false,
|
||||||
|
"separate-output": true
|
||||||
|
},
|
||||||
|
"hyprland/workspaces": {
|
||||||
|
"disable-scroll": true,
|
||||||
|
"active-only": false,
|
||||||
|
"all-outputs": true,
|
||||||
|
"on-click": "activate",
|
||||||
|
"format": "{name}{icon}{windows}",
|
||||||
|
"format-icons": {
|
||||||
|
"urgent": " ",
|
||||||
|
"default": " ",
|
||||||
|
"empty": ""
|
||||||
|
},
|
||||||
|
"window-rewrite": {
|
||||||
|
"WhatsDesk": " ",
|
||||||
|
"class<Alacritty>": " ",
|
||||||
|
"class<chromium>": " ",
|
||||||
|
"class<com.ayugram.desktop>": " ",
|
||||||
|
"class<discord>": " ",
|
||||||
|
"class<equibop>": " ",
|
||||||
|
"class<obsidian>": " ",
|
||||||
|
"class<org.keepassxc.KeePassXC>": " ",
|
||||||
|
"class<org.telegram.desktop>": " ",
|
||||||
|
"class<spotify>": " ",
|
||||||
|
"class<steam>": " ",
|
||||||
|
"class<thunar>": " ",
|
||||||
|
"class<gamescope>": " ",
|
||||||
|
"title<Hollow Knight Silksong>": " ",
|
||||||
|
"title<.*YouTube Music>": " ",
|
||||||
|
"title<.*YouTube>": " ",
|
||||||
|
"title<Installed packages>": " ",
|
||||||
|
"title<Updates>": " "
|
||||||
|
},
|
||||||
|
"persistent-workspaces": {
|
||||||
|
"*": 10,
|
||||||
|
"HDMI-A-1": [
|
||||||
|
11,
|
||||||
|
12
|
||||||
|
],
|
||||||
|
"DP-1": [
|
||||||
|
11,
|
||||||
|
12
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tray": {
|
||||||
|
"icon-size": 16,
|
||||||
|
"spacing": 10
|
||||||
|
},
|
||||||
|
"clock": {
|
||||||
|
// "interval": 1,
|
||||||
|
// "format": "{:%H:%M:%S}",
|
||||||
|
// "locale": "it_IT.UTF-8",
|
||||||
|
// "tooltip-format": "<tt><small>{calendar}</small></tt>",
|
||||||
|
// "format-alt": "{:L%a %d/%m/%y (%H:%M:%S)}",
|
||||||
|
// "calendar": {
|
||||||
|
// "mode": "month",
|
||||||
|
// "mode-mon-col": 3,
|
||||||
|
// "weeks-pos": "right",
|
||||||
|
// "on-scroll": 1,
|
||||||
|
// "format": {
|
||||||
|
// "months": "<span color='#ffead3'><b>{}</b></span>",
|
||||||
|
// "days": "<span color='#ecc6d9'><b>{}</b></span>",
|
||||||
|
// "weeks": "<span color='#99ffdd'><b>W{}</b></span>",
|
||||||
|
// "weekdays": "<span color='#ffcc66'><b>{}</b></span>",
|
||||||
|
// "today": "<span color='#ff6699'><b><u>{}</u></b></span>"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
"format": "{:%H:%M} ",
|
||||||
|
"format-alt": "{:L%A, %B %d, %Y (%R)} ",
|
||||||
|
"tooltip-format": "\n<span size='9pt' font='WenQuanYi Zen Hei Mono'>{calendar}</span>",
|
||||||
|
"calendar": {
|
||||||
|
"mode": "year",
|
||||||
|
"mode-mon-col": 3,
|
||||||
|
"weeks-pos": "right",
|
||||||
|
"on-scroll": 1,
|
||||||
|
"format": {
|
||||||
|
"months": "<span color='#ffead3'><b>{}</b></span>",
|
||||||
|
"days": "<span color='#ecc6d9'><b>{}</b></span>",
|
||||||
|
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
|
||||||
|
"weekdays": "<span color='#ffcc66'><b>{}</b></span>",
|
||||||
|
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"on-click-right": "mode",
|
||||||
|
"on-click-forward": "tz_up",
|
||||||
|
"on-click-backward": "tz_down",
|
||||||
|
"on-scroll-up": "shift_up",
|
||||||
|
"on-scroll-down": "shift_down"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"thermal-zone": 7,
|
||||||
|
"interval": 5,
|
||||||
|
"format": "{icon}{temperatureC}°C",
|
||||||
|
"format-icons": [
|
||||||
|
" "
|
||||||
|
],
|
||||||
|
"format-alt-click": "click-right",
|
||||||
|
"critical-threshold": 80,
|
||||||
|
"format-critical": " {temperatureC}°C",
|
||||||
|
"on-click": "kitty --title btop sh -c 'btop'",
|
||||||
|
"tooltip-format": "CPU temperature",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||||
|
// internet speed: "
|
||||||
|
"format-wifi": "{essid} ({signalStrength}%) ",
|
||||||
|
"format-ethernet": "{ipaddr}/{cidr} ",
|
||||||
|
"tooltip-format": "{ifname}: via {gwaddr} \n<small>down/up: {bandwidthDownBytes} {bandwidthUpBytes}</small>",
|
||||||
|
"format-linked": "{ifname} (No IP) ",
|
||||||
|
"format-disconnected": "Disconnesso ",
|
||||||
|
"format-alt": "{ifname}: {ipaddr}/{cidr}",
|
||||||
|
"interval": 1,
|
||||||
|
"on-click-right": "kitty -e nmtui",
|
||||||
|
"max-length": 30
|
||||||
|
},
|
||||||
|
"custom/updates": {
|
||||||
|
//"format": " {}",
|
||||||
|
"format": " {}",
|
||||||
|
// "tooltip-format": "Aggiorna il Sistema\n<small>Pacchetti: {}</small>",
|
||||||
|
"escape": true,
|
||||||
|
"return-type": "json",
|
||||||
|
"exec": "~/.config/waybar/scripts/updates.sh",
|
||||||
|
"restart-interval": 3600,
|
||||||
|
"on-click": "kitty --title Updates sh -c ~/.config/waybar/scripts/installaupdates.sh",
|
||||||
|
"on-click-right": "kitty --title 'Installed packages' sh -c ~/.config/waybar/scripts/listpackages.sh",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
"custom/swaync": {
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"notification": "<span foreground='red'><small><sup>⬤</sup></small></span>",
|
||||||
|
"none": " ",
|
||||||
|
"dnd-notification": "<span foreground='red'><small><sup>⬤</sup></small></span>",
|
||||||
|
"dnd-none": " "
|
||||||
|
},
|
||||||
|
"return-type": "json",
|
||||||
|
"exec-if": "which swaync-client",
|
||||||
|
"exec": "swaync-client -swb",
|
||||||
|
"on-click": "sleep 0.1 && swaync-client -t -sw",
|
||||||
|
"escape": true,
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
"custom/wl-gammarelay-temperature": {
|
||||||
|
"format": "{} {icon}",
|
||||||
|
"format-alt": "{icon}",
|
||||||
|
"format-icons": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"exec": "wl-gammarelay --subscribe Temperature",
|
||||||
|
"on-scroll-up": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n +100",
|
||||||
|
"on-scroll-down": "busctl --user -- call rs.wl-gammarelay / rs.wl.gammarelay UpdateTemperature n -100",
|
||||||
|
"tooltip-format": "Temperatura Schermo: {} K",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
"custom/media": {
|
||||||
|
"format": "{}",
|
||||||
|
"escape": true,
|
||||||
|
"return-type": "json",
|
||||||
|
"max-length": 40,
|
||||||
|
"on-click": "playerctl play-pause",
|
||||||
|
"on-click-right": "playerctl stop",
|
||||||
|
"smooth-scrolling-threshold": 10, // This value was tested using a trackpad, it should be lowered if using a mouse.
|
||||||
|
"on-scroll-up": "playerctl next",
|
||||||
|
"on-scroll-down": "playerctl previous",
|
||||||
|
"exec": "~/.config/waybar/scripts/mediaplayer.py", // Script in resources/custom_modules folder
|
||||||
|
"tooltip": true,
|
||||||
|
"tooltip-format": "{}"
|
||||||
|
}
|
||||||
|
}
|
||||||
205
.config/waybar/scripts/mediaplayer.py
Executable file
205
.config/waybar/scripts/mediaplayer.py
Executable file
@@ -0,0 +1,205 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import gi
|
||||||
|
gi.require_version("Playerctl", "2.0")
|
||||||
|
from gi.repository import Playerctl, GLib
|
||||||
|
from gi.repository.Playerctl import Player
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import signal
|
||||||
|
import gi
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
def signal_handler(sig, frame):
|
||||||
|
logger.info("Received signal to stop, exiting")
|
||||||
|
sys.stdout.write("\n")
|
||||||
|
sys.stdout.flush()
|
||||||
|
# loop.quit()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
class PlayerManager:
|
||||||
|
def __init__(self, selected_player=None, excluded_player=[]):
|
||||||
|
self.manager = Playerctl.PlayerManager()
|
||||||
|
self.loop = GLib.MainLoop()
|
||||||
|
self.manager.connect(
|
||||||
|
"name-appeared", lambda *args: self.on_player_appeared(*args))
|
||||||
|
self.manager.connect(
|
||||||
|
"player-vanished", lambda *args: self.on_player_vanished(*args))
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
|
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
|
self.selected_player = selected_player
|
||||||
|
self.excluded_player = excluded_player.split(',') if excluded_player else []
|
||||||
|
|
||||||
|
self.init_players()
|
||||||
|
|
||||||
|
def init_players(self):
|
||||||
|
for player in self.manager.props.player_names:
|
||||||
|
if player.name in self.excluded_player:
|
||||||
|
continue
|
||||||
|
if self.selected_player is not None and self.selected_player != player.name:
|
||||||
|
logger.debug(f"{player.name} is not the filtered player, skipping it")
|
||||||
|
continue
|
||||||
|
self.init_player(player)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
logger.info("Starting main loop")
|
||||||
|
self.loop.run()
|
||||||
|
|
||||||
|
def init_player(self, player):
|
||||||
|
logger.info(f"Initialize new player: {player.name}")
|
||||||
|
player = Playerctl.Player.new_from_name(player)
|
||||||
|
player.connect("playback-status",
|
||||||
|
self.on_playback_status_changed, None)
|
||||||
|
player.connect("metadata", self.on_metadata_changed, None)
|
||||||
|
self.manager.manage_player(player)
|
||||||
|
self.on_metadata_changed(player, player.props.metadata)
|
||||||
|
|
||||||
|
def get_players(self) -> List[Player]:
|
||||||
|
return self.manager.props.players
|
||||||
|
|
||||||
|
def write_output(self, text, player):
|
||||||
|
logger.debug(f"Writing output: {text}")
|
||||||
|
|
||||||
|
output = {"text": text,
|
||||||
|
"class": "custom-" + player.props.player_name,
|
||||||
|
"alt": player.props.player_name}
|
||||||
|
|
||||||
|
sys.stdout.write(json.dumps(output) + "\n")
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def clear_output(self):
|
||||||
|
sys.stdout.write("\n")
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def on_playback_status_changed(self, player, status, _=None):
|
||||||
|
logger.debug(f"Playback status changed for player {player.props.player_name}: {status}")
|
||||||
|
self.on_metadata_changed(player, player.props.metadata)
|
||||||
|
|
||||||
|
def get_first_playing_player(self):
|
||||||
|
players = self.get_players()
|
||||||
|
logger.debug(f"Getting first playing player from {len(players)} players")
|
||||||
|
if len(players) > 0:
|
||||||
|
# if any are playing, show the first one that is playing
|
||||||
|
# reverse order, so that the most recently added ones are preferred
|
||||||
|
for player in players[::-1]:
|
||||||
|
if player.props.status == "Playing":
|
||||||
|
return player
|
||||||
|
# if none are playing, show the first one
|
||||||
|
return players[0]
|
||||||
|
else:
|
||||||
|
logger.debug("No players found")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def show_most_important_player(self):
|
||||||
|
logger.debug("Showing most important player")
|
||||||
|
# show the currently playing player
|
||||||
|
# or else show the first paused player
|
||||||
|
# or else show nothing
|
||||||
|
current_player = self.get_first_playing_player()
|
||||||
|
if current_player is not None:
|
||||||
|
self.on_metadata_changed(current_player, current_player.props.metadata)
|
||||||
|
else:
|
||||||
|
self.clear_output()
|
||||||
|
|
||||||
|
def on_metadata_changed(self, player, metadata, _=None):
|
||||||
|
logger.debug(f"Metadata changed for player {player.props.player_name}")
|
||||||
|
player_name = player.props.player_name
|
||||||
|
artist = player.get_artist()
|
||||||
|
title = player.get_title()
|
||||||
|
title = title.replace("&", "&")
|
||||||
|
|
||||||
|
track_info = ""
|
||||||
|
if player_name == "spotify" and "mpris:trackid" in metadata.keys() and ":ad:" in player.props.metadata["mpris:trackid"]:
|
||||||
|
track_info = "Advertisement"
|
||||||
|
elif artist is not None and title is not None:
|
||||||
|
track_info = f"{artist} - {title}"
|
||||||
|
else:
|
||||||
|
track_info = title
|
||||||
|
|
||||||
|
# TODO Add Icons
|
||||||
|
if track_info:
|
||||||
|
if player_name == "spotify":
|
||||||
|
track_info = track_info + " "
|
||||||
|
elif "chromium" in player_name:
|
||||||
|
track_info = track_info + " "
|
||||||
|
if player.props.status == "Playing":
|
||||||
|
track_info = " " + track_info
|
||||||
|
elif player.props.status == "Paused":
|
||||||
|
track_info = " " + track_info
|
||||||
|
|
||||||
|
# ! if status it "Stopped", chromium still shows as playing even after closing tab. Open issue with chromium
|
||||||
|
if player.props.status == "Stopped":
|
||||||
|
track_info = ""
|
||||||
|
|
||||||
|
# only print output if no other player is playing
|
||||||
|
current_playing = self.get_first_playing_player()
|
||||||
|
if current_playing is None or current_playing.props.player_name == player.props.player_name:
|
||||||
|
self.write_output(track_info, player)
|
||||||
|
else:
|
||||||
|
logger.debug(f"Other player {current_playing.props.player_name} is playing, skipping")
|
||||||
|
|
||||||
|
def on_player_appeared(self, _, player):
|
||||||
|
logger.info(f"Player has appeared: {player.name}")
|
||||||
|
if player.name in self.excluded_player:
|
||||||
|
logger.debug(
|
||||||
|
"New player appeared, but it's in exclude player list, skipping")
|
||||||
|
return
|
||||||
|
if player is not None and (self.selected_player is None or player.name == self.selected_player):
|
||||||
|
self.init_player(player)
|
||||||
|
else:
|
||||||
|
logger.debug(
|
||||||
|
"New player appeared, but it's not the selected player, skipping")
|
||||||
|
|
||||||
|
def on_player_vanished(self, _, player):
|
||||||
|
logger.info(f"Player {player.props.player_name} has vanished")
|
||||||
|
self.show_most_important_player()
|
||||||
|
|
||||||
|
def parse_arguments():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
# Increase verbosity with every occurrence of -v
|
||||||
|
parser.add_argument("-v", "--verbose", action="count", default=0)
|
||||||
|
|
||||||
|
parser.add_argument("-x", "--exclude", "- Comma-separated list of excluded player")
|
||||||
|
|
||||||
|
# Define for which player we"re listening
|
||||||
|
parser.add_argument("--player")
|
||||||
|
|
||||||
|
parser.add_argument("--enable-logging", action="store_true")
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
arguments = parse_arguments()
|
||||||
|
|
||||||
|
# Initialize logging
|
||||||
|
if arguments.enable_logging:
|
||||||
|
logfile = os.path.join(os.path.dirname(
|
||||||
|
os.path.realpath(__file__)), "media-player.log")
|
||||||
|
logging.basicConfig(filename=logfile, level=logging.DEBUG,
|
||||||
|
format="%(asctime)s %(name)s %(levelname)s:%(lineno)d %(message)s")
|
||||||
|
|
||||||
|
# Logging is set by default to WARN and higher.
|
||||||
|
# With every occurrence of -v it's lowered by one
|
||||||
|
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
|
||||||
|
|
||||||
|
logger.info("Creating player manager")
|
||||||
|
if arguments.player:
|
||||||
|
logger.info(f"Filtering for player: {arguments.player}")
|
||||||
|
if arguments.exclude:
|
||||||
|
logger.info(f"Exclude player {arguments.exclude}")
|
||||||
|
|
||||||
|
player = PlayerManager(arguments.player, arguments.exclude)
|
||||||
|
player.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
4
.config/waybar/scripts/reload-waybar.sh
Executable file
4
.config/waybar/scripts/reload-waybar.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
killall waybar
|
||||||
|
waybar
|
||||||
155
.config/waybar/style.css
Normal file
155
.config/waybar/style.css
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
* {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
font-family: "Fira Code", FontAwesome;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
background-color: rgba(0, 0, 0, 0);
|
||||||
|
border-bottom: 0.5px solid #fffff0;
|
||||||
|
background: rgba(21, 18, 27, 0.6);
|
||||||
|
color: #cdd6f4;
|
||||||
|
transition-property: background-color;
|
||||||
|
transition-duration: .5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar.hidden {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
tooltip {
|
||||||
|
background: rgba(8, 7, 10, 0.8);
|
||||||
|
border-radius: 18px;
|
||||||
|
border-width: 2px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #11111b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#workspaces {
|
||||||
|
background: rgba(8, 7, 10, 0.6);
|
||||||
|
margin: 5px 5px 5px 5px;
|
||||||
|
padding: 6px 5px;
|
||||||
|
border-radius: 18px;
|
||||||
|
margin-top: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
/* margin-left: 5px;
|
||||||
|
margin-right: 5px; */
|
||||||
|
border: 0.5px solid #032412;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button {
|
||||||
|
padding: 0px 5px;
|
||||||
|
margin: 0px 3px;
|
||||||
|
border-radius: 16px;
|
||||||
|
color: #cdd6f4;
|
||||||
|
background-color: #2f354a;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#workspaces button.empty {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.active {
|
||||||
|
color: #2f354a;
|
||||||
|
background-color: #cdd6f4;
|
||||||
|
border-radius: 16px;
|
||||||
|
min-width: 50px;
|
||||||
|
background-size: 400% 400%;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
/*opacity: 1.0;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.urgent {
|
||||||
|
background-color: #cdd6f4;
|
||||||
|
color: #2f354a;
|
||||||
|
padding: 0 0 0 5px;
|
||||||
|
border-radius: 16px;
|
||||||
|
min-width: 40px;
|
||||||
|
background-size: 300% 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button:hover {
|
||||||
|
background-color: #cdd6f4;
|
||||||
|
color: #2f354a;
|
||||||
|
border-radius: 16px;
|
||||||
|
min-width: 50px;
|
||||||
|
background-size: 400% 400%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#clock,
|
||||||
|
#window,
|
||||||
|
#custom-media,
|
||||||
|
#backlight,
|
||||||
|
#custom-wl-gammarelay-temperature,
|
||||||
|
#tray,
|
||||||
|
#custom-swaync {
|
||||||
|
background-color: #2f354a;
|
||||||
|
margin: 0 0 0 0;
|
||||||
|
padding: 0px 7px 0px 7px;
|
||||||
|
border-radius: 18px;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* LEFT MODULES */
|
||||||
|
|
||||||
|
#window {
|
||||||
|
background: #cdd6f4;
|
||||||
|
color: #1e1e2e;
|
||||||
|
border-radius: 18px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
window#waybar.empty #window {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CENTER MODULES */
|
||||||
|
|
||||||
|
#clock {
|
||||||
|
border-radius: 18px;
|
||||||
|
color: #fab387;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RIGHT MODULES */
|
||||||
|
|
||||||
|
#custom-media {
|
||||||
|
padding-right: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-media.custom-spotify {
|
||||||
|
color: #1db954;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-wl-gammarelay-temperature {
|
||||||
|
border-radius: 0px 0px 0px 0px;
|
||||||
|
padding: 0px 0px 0px 7px;
|
||||||
|
color: #d99280;
|
||||||
|
}
|
||||||
|
|
||||||
|
#backlight {
|
||||||
|
border-radius: 0px 18px 18px 0px;
|
||||||
|
margin-right: 5px
|
||||||
|
}
|
||||||
|
|
||||||
|
#tray {
|
||||||
|
border-radius: 18px 0 0 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-swaync {
|
||||||
|
border-radius: 0px 18px 18px 0px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user