hyprland, wofi, waybar, kitty

This commit is contained in:
wooshdude
2024-09-22 01:40:10 -07:00
parent 9e28798ef4
commit da9850910c
16 changed files with 1694 additions and 2 deletions
+192
View File
@@ -0,0 +1,192 @@
# #######################################################################################
# AUTOGENERATED HYPR CONFIG.
# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
# #######################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
monitor = DP-1, 1920x1080@144, auto, auto
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
exec-once = waybar
exec-once = hyperpaper
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# Set programs that you use
$terminal = kitty
$fileManager = nautilus
$menu = wofi --show drun
# Some default env vars.
env = XCURSOR_THEME,oreo_red
env = XCURSOR_SIZE,24
env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
touchpad {
natural_scroll = no
}
sensitivity = -0.1 # -1.0 to 1.0, 0 means no modification.
accel_profile = flat
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
gaps_in = 6
gaps_out = 14
border_size = 2
col.active_border = rgba(e78284ff) rgba(85c1dcff) rgba(ca9ee6ff) rgba(ea999cff) 45deg
col.inactive_border = rgba(1e1e2eff)
layout = dwindle
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 10
blur {
enabled = true
size = 3
passes = 1
}
drop_shadow = yes
shadow_range = 4
shadow_render_power = 3
col.shadow = 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 = borderangle, 1, 8, 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_is_master = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
misc {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
device {
name = epic-mouse-v1
sensitivity = -0.5
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
# 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, $terminal
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, space, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, R, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, H, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
# 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 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, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
+215
View File
@@ -0,0 +1,215 @@
{
"layer": "top",
"output": "DP-1",
"position": "top",
"spacing": 4,
"margin-top": 8,
"margin-bottom": 0,
"margin-left": 12,
"margin-right": 12,
"modules-left": [
"hyprland/workspaces",
"custom/spotify",
],
"modules-center": [
"clock"
],
"modules-right": [
"backlight",
"pulseaudio",
"network",
"battery",
],
"custom/icon": {
"format": "󰣇",
"on-click": "~/.config/rofi/bin/launcher",
"tooltip": false
},
"cpu": {
"interval": 10,
"format": " {usage}%",
"max-length": 10,
"tooltip": false
},
"clock": {
"format": "<b>󰥔 {:%H:%M 󰃭 %d/%m}</b> ",
//"format": "{:%a}",
"tooltip-format": "<tt>{calendar}</tt>",
"calendar": {
"mode" : "month",
"format": {
"months": "<span color='#cdd6f4'><b>{}</b></span>",
"days": "<span color='#cdd6f4'><b>{}</b></span>",
"weeks": "<span color='#cdd6f4'><b>W{}</b></span>",
"weekdays": "<span color='#cdd6f4'><b>{}</b></span>",
"today": "<span color='#f38ba8'><b>{}</b></span>"
}
},
},
"memory": {
"interval": 30,
"format": " {used}GiB",
"format-alt": " {used:0.1f}G",
"max-length": 10
},
"temperature": {
"format": " {temperatureF}°F"
},
"hyprland/window": {
"format": " {}",
"rewrite": {
"(.*) - NVIM": " NeoVim",
"(.*) — Mozilla Firefox": "󰈹 Firefox",
" ": "󰇄 Desktop",
"(.*) Spotify Free": "󰓇 Spotify",
"(.*) Spotify": "󰓇 Spotify",
" ~": " l6174@Radon",
"(.*) - Obsidian(.*)": "󱓧 Obsidian",
}
},
"hyprland/workspaces" : {
"on-click": "activate",
"active-only": false,
"all-outputs": true,
"format": "{icon}",
"format-icons": {
"urgent": "",
"active": "",
"default": ""
},
"persistent-workspaces": {
"*": 4
}
},
"backlight": {
"format": "{icon} <b>{percent}%</b>",
"format-icons": ["󰃞", "󰃟", "󰃠"],
"tooltip": false,
},
"pulseaudio": {
"format": "{icon} <b>{volume}%</b>",
"format-bluetooth": "{icon}  <b>{volume}%</b>",
"format-bluetooth-muted": "󰝟 ",
"format-muted": " 󰝟 ",
"format-icons": {
"headset": "",
"default": ["󰕿", "󰖀", "󰕾"],
},
"tooltip": false,
"on-click": "pavucontrol",
},
"network": {
"interval": 30,
"format-wifi": "󰤨 {essid}",
"format-ethernet": "󰈀 Wired",
"fomat-disconnected": "󱚵 Disconnected",
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": ["󰂎", "󰁻", "󰁽", "󰁿", "󰂁", "󰁹"],
"max-length": 25,
"tooltip": false,
},
"tray": {
"icon-size": 20,
"spacing": 10,
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "󰈈 ",
"deactivated": "󰈉 "
},
},
"custom/separator-space": {
"format": " ",
"tooltip": false,
},
"custom/separator-gap": {
"format": " ",
"tooltip": false,
},
"custom/separator-arrow": {
"format": "  ",
"tooltip": false,
},
"custom/spotify": {
"format": "{} ",
"max-length": 60,
"interval": "once",
"return-type": "json",
"exec": "~/.local/bin/spotifyctl",
"on-click": "playerctl --player=spotify play-pause && pkill -RTMIN+30 waybar",
"on-click-right": "playerctl --player=spotify loop track",
"on-scroll-down": "playerctl --player=spotify previous && pkill -RTMIN+30 waybar",
"on-scroll-up": "playerctl --player=spotify next && pkill -RTMIN+30 waybar",
"on-click-middle": "pkill --signal TERM spotify",
"signal": 30,
"smooth-scrolling-threshold": 1.0,
},
"custom/power": {
"format": "󰐥",
"on-click": "~/.config/rofi/bin/power.sh",
"tooltip": false,
},
"custom/notification": {
"tooltip": false,
"format": "{icon}",
"format-icons": {
"notification": "󱅫 ",
"none": "󰂚 ",
"dnd-notification": "󰵙 ",
"dnd-none": "󰂛 ",
"inhibited-notification": "󱅫 ",
"inhibited-none": "󰂚 ",
"dnd-inhibited-notification": "󰵙 ",
"dnd-inhibited-none": "󰂛​"
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
"custom/updates": {
"format": " {}",
"tooltip-format": "{}",
"escape": true,
"return-type": "json",
"exec": "~/.config/waybar/custom-scripts/updates",
"restart-interval": 60,
"on-click": "kitty -e ~/.config/waybar/custom-scripts/update",
"tooltip": false
},
}
+152
View File
@@ -0,0 +1,152 @@
{
"layer": "top",
"position": "top",
"spacing": 4,
"margin-top": 5,
"margin-bottom": 0,
"margin-left": 5,
"margin-right": 5,
"modules-left": [
"custom/icon",
"custom/separator-gap",
"cpu",
"memory",
"temperature",
"custom/separator-arrow",
"hyprland/window",
],
"modules-center": [
"hyprland/workspaces",
],
"modules-right": [
"backlight",
"pulseaudio",
"network",
"battery",
"tray",
"custom/separator-dot",
"clock",
"custom/power",
],
"custom/icon": {
"format": "󰣇"
},
"cpu": {
"interval": 10,
"format": " {usage}%",
"max-length": 10,
"tooltip": false
},
"memory": {
"interval": 30,
"format": " {used}GiB",
"format-alt": " {used:0.1f}G",
"max-length": 10
},
"temperature": {
"format": " {temperatureF}°F"
},
"hyprland/window": {
"format": " {}",
"rewrite": {
"(.*) - NVIM": " NeoVim",
"(.*) — Mozilla Firefox": "󰈹 Mozilla Firefox",
}
},
"hyprland/workspaces": {
"all-outputs": true,
"format": "{icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"urgent": "",
"active": "",
"default": ""
}
},
"backlight": {
"format": "{icon} <b>{percent}</b>",
"format-icons": ["󰃟", "󰃠"],
"tooltip": false,
},
"pulseaudio": {
"format": "{icon} <b>{volume}</b>",
"format-bluetooth": "{icon}  {volume}%",
"format-bluetooth-muted": "󰝟 ",
"format-muted": " 󰝟 ",
"format-icons": {
"headph": "",
"default": ["󰝟 ", ""],
},
"tooltip": false,
"on-click": "pavucontrol",
},
"network": {
"interval": 30,
"format-wifi": "󰖩 {essid}",
"format-ethernet": "󰈀 Wired",
"fomat-disconnected": "󱚵 Disconnected",
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": [" ", " ", " ", " ", " "],
"max-length": 25,
"tooltip": false,
},
"tray": {
"icon-size": 20,
"spacing": 10,
},
"custom/separator-dot": {
"format": "  ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/random-wallpaper"
},
"custom/separator-gap": {
"format": " ",
"tooltip": false,
},
"custom/separator-arrow": {
"format": "  ",
"tooltip": false,
},
"custom/spotify": {
"exec": "/usr/bin/python3 $HOME/.config/waybar/custom-scripts/mediaplayer.py --player spotify --verbose",
"format": "{} ",
"return-type": "json",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
"custom/power": {
"format": "",
"on-click": "~/.config/rofi/bin/powermenu",
"tooltip": false,
},
}
+170
View File
@@ -0,0 +1,170 @@
{
"layer": "top",
"position": "top",
"spacing": 4,
"margin-top": 5,
"margin-bottom": 0,
"margin-left": 5,
"margin-right": 5,
"modules-left": [
"custom/icon",
"clock",
"custom/spotify",
],
"modules-center": [
"hyprland/window",
"custom/separator-arrow",
"hyprland/workspaces",
],
"modules-right": [
"backlight",
"pulseaudio",
"network",
"battery",
"tray",
"custom/power",
],
"custom/icon": {
"format": "󰣇",
"on-click": "~/.config/rofi/bin/launcher",
"tooltip": false
},
"cpu": {
"interval": 10,
"format": " {usage}%",
"max-length": 10,
"tooltip": false
},
clock": {
"format": "{: %d-%m-24  %H:%M}",
//"format": "{:%a}",
"tooltip-format": "<tt>{calendar}</tt>",
"calendar": {
"mode" : "month",
"format": {
"months": "<span color='#cdd6f4'><b>{}</b></span>",
"days": "<span color='#cdd6f4'><b>{}</b></span>",
"weeks": "<span color='#cdd6f4'><b>W{}</b></span>",
"weekdays": "<span color='#cdd6f4'><b>{}</b></span>",
"today": "<span color='#f38ba8'><b>{}</b></span>"
}
},
},
"memory": {
"interval": 30,
"format": " {used}GiB",
"format-alt": " {used:0.1f}G",
"max-length": 10
},
"temperature": {
"format": " {temperatureF}°F"
},
"hyprland/window": {
"format": " {}",
"rewrite": {
"(.*) - NVIM": " NeoVim",
"(.*) — Mozilla Firefox": "󰈹 Mozilla Firefox",
" ": "󰇄 Desktop",
"(.*) Spotify Free": "󰓇 Spotify",
"(.*) Spotify": "󰓇 Spotify",
" ~": " l6174@Radon",
"(.*) - Obsidian(.*)": "󱓧 Obsidian",
}
},
"hyprland/workspaces": {
"all-outputs": true,
"format": "{icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"urgent": "",
"active": "",
"default": ""
}
},
"backlight": {
"format": "{icon} <b>{percent}</b>",
"format-icons": ["󰃟", "󰃠"],
"tooltip": false,
},
"pulseaudio": {
"format": "{icon} <b>{volume}</b>",
"format-bluetooth": "{icon}  {volume}%",
"format-bluetooth-muted": "󰝟 ",
"format-muted": " 󰝟 ",
"format-icons": {
"headset": "",
"default": ["", ""],
},
"tooltip": false,
"on-click": "pavucontrol",
},
"network": {
"interval": 30,
"format-wifi": "󰖩 {essid}",
"format-ethernet": "󰈀 Wired",
"fomat-disconnected": "󱚵 Disconnected",
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": [" ", " ", " ", " ", " "],
"max-length": 25,
"tooltip": false,
},
"tray": {
"icon-size": 20,
"spacing": 10,
},
"custom/separator-dot": {
"format": "  ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/random-wallpaper"
},
"custom/separator-gap": {
"format": " ",
"tooltip": false,
},
"custom/separator-arrow": {
"format": "  ",
"tooltip": false,
},
"custom/spotify": {
"exec": "/usr/bin/python3 $HOME/.config/waybar/custom-scripts/mediaplayer.py --player spotify --verbose",
"format": " {}  ",
"return-type": "json",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
"custom/power": {
"format": "󰐥",
"on-click": "~/.config/rofi/bin/powermenu",
"tooltip": false,
},
}
+207
View File
@@ -0,0 +1,207 @@
{
"layer": "top",
"position": "top",
"spacing": 4,
"margin-top": 5,
"margin-bottom": 0,
"margin-left": 5,
"margin-right": 5,
"modules-left": [
"custom/icon",
"custom/separator-space",
"hyprland/workspaces",
"custom/spotify",2
"custom/separator-arrow",
"hyprland/window",
],
"modules-center": [
"clock"
],
"modules-right": [
"backlight",
"pulseaudio",
"network",
"battery",
"tray",
"custom/inhibitor",
"custom/notification",
"custom/power",
],
"custom/icon": {
"format": "󰣇",
"on-click": "~/.config/rofi/bin/launcher",
"tooltip": false
},
"cpu": {
"interval": 10,
"format": " {usage}%",
"max-length": 10,
"tooltip": false
},
"clock": {
"format": "<b>󰥔 {:%H:%M 󰃭 %d/%m} </b>",
//"format": "{:%a}",
"tooltip-format": "<tt>{calendar}</tt>",
"calendar": {
"mode" : "month",
"format": {
"months": "<span color='#cdd6f4'><b>{}</b></span>",
"days": "<span color='#cdd6f4'><b>{}</b></span>",
"weeks": "<span color='#cdd6f4'><b>W{}</b></span>",
"weekdays": "<span color='#cdd6f4'><b>{}</b></span>",
"today": "<span color='#f38ba8'><b>{}</b></span>"
}
},
},
"memory": {
"interval": 30,
"format": " {used}GiB",
"format-alt": " {used:0.1f}G",
"max-length": 10
},
"temperature": {
"format": " {temperatureF}°F"
},
"hyprland/window": {
"format": " {}",
"rewrite": {
"(.*) - NVIM": " NeoVim",
"(.*) — Mozilla Firefox": "󰈹 Firefox",
" ": "󰇄 Desktop",
"(.*) Spotify Free": "󰓇 Spotify",
"(.*) Spotify": "󰓇 Spotify",
" ~": " l6174@Radon",
"(.*) - Obsidian(.*)": "󱓧 Obsidian",
}
},
"hyprland/workspaces": {
"all-outputs": false,
"format": "{icon}",
"format-icons": {
"urgent": " ",
"persistent": " ",
"active": " ",
"empty": " "
},
"persistent-workspaces": {
"1": [],
"2": [],
"3": [],
"4": []
}
},
"backlight": {
"format": "{icon} <b>{percent}</b>",
"format-icons": ["󰃞", "󰃟", "󰃠"],
"tooltip": false,
},
"pulseaudio": {
"format": "{icon} <b>{volume}</b>",
"format-bluetooth": "{icon}  {volume}%",
"format-bluetooth-muted": "󰝟 ",
"format-muted": " 󰝟 ",
"format-icons": {
"headset": "",
"default": ["󰕿", "󰖀", "󰕾"],
},
"tooltip": false,
"on-click": "pavucontrol",
},
"network": {
"interval": 30,
"format-wifi": "󰤨 {essid}",
"format-ethernet": "󰈀 Wired",
"fomat-disconnected": "󱚵 Disconnected",
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname} ",
"tooltip-format-disconnected": "Disconnected",
},
"battery": {
"states": {
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": ["󰂎", "󰁻", "󰁽", "󰁿", "󰂁", "󰁹"],
"max-length": 25,
"tooltip": false,
},
"tray": {
"icon-size": 20,
"spacing": 10,
},
"custom/inhibitor": {
"exec": "~/.local/bin/waybar-inhibitor",
"interval": 5,
"return-type": "json",
"tooltip": true,
"on-click": "~/.local/bin/inhibitor",
"signal": 10
},
"custom/separator-dot": {
"format": "  ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/random-wallpaper"
},
"custom/separator-gap": {
"format": " ",
"tooltip": false,
},
"custom/separator-arrow": {
"format": "  ",
"tooltip": false,
},
"custom/spotify": {
"exec": "/usr/bin/python3 $HOME/.config/waybar/custom-scripts/mediaplayer.py --player spotify --verbose",
"format": " {}  ",
"return-type": "json",
"on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous"
},
"custom/power": {
"format": "󰐥",
"on-click": "~/.config/rofi/bin/powermenu",
"tooltip": false,
},
"custom/notification": {
"tooltip": false,
"format": "{icon}",
"format-icons": {
"notification": "󱅫 ",
"none": "󰂚 ",
"dnd-notification": "󰵙 ",
"dnd-none": "󰂛 ",
"inhibited-notification": "󱅫 ",
"inhibited-none": "󰂚 ",
"dnd-inhibited-notification": "󰵙 ",
"dnd-inhibited-none": "󰂛​"
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
}
@@ -0,0 +1,179 @@
#!/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):
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.init_players()
def init_players(self):
for player in self.manager.props.player_names:
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
title = player.get_title()
track_info = ""
if player_name == "spotify" and "mpris:trackid" in metadata.keys() and ":ad:" in player.props.metadata["mpris:trackid"]:
track_info = "Advertisement"
else:
track_info = title
if track_info:
if player.props.status == "Playing":
track_info = "" + track_info
else:
track_info = "" + 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 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)
# 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}")
player = PlayerManager(arguments.player)
player.run()
if __name__ == "__main__":
main()
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
sleep 1
figlet "Update"
sleep 0.5
echo "."
sleep 0.5
echo "."
sleep 0.5
echo "."
sleep 0.5
arch-update
+63
View File
@@ -0,0 +1,63 @@
#!/bin/bash
# _ _ _ _
# | | | |_ __ __| | __ _| |_ ___ ___
# | | | | '_ \ / _` |/ _` | __/ _ \/ __|
# | |_| | |_) | (_| | (_| | || __/\__ \
# \___/| .__/ \__,_|\__,_|\__\___||___/
# |_|
#
# by Stephan Raabe (2023)
# -----------------------------------------------------
# -----------------------------------------------------
# Define threshholds for color indicators
# -----------------------------------------------------
threshhold_green=0
threshhold_yellow=25
threshhold_red=100
# -----------------------------------------------------
# Calculate available updates pacman and aur (with aur)
# -----------------------------------------------------
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
if ! updates_aur=$(paru -Qua | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
# -----------------------------------------------------
# Testing
# -----------------------------------------------------
# Overwrite updates with numbers for testing
# updates=50
# test JSON output
# printf '{"text": "0", "alt": "0", "tooltip": "0 Updates", "class": "red"}'
# exit
# -----------------------------------------------------
# Output in JSON format for Waybar Module custom-updates
# -----------------------------------------------------
css_class="green"
if [ "$updates" -gt $threshhold_yellow ]; then
css_class="yellow"
fi
if [ "$updates" -gt $threshhold_red ]; then
css_class="red"
fi
if [ "$updates" -gt $threshhold_green ]; then
printf '{"text": "%s", "alt": "%s", "tooltip": "%s Updates", "class": "%s"}' "$updates" "$updates" "$updates" "$css_class"
else
printf '{"text": "0", "alt": "0", "tooltip": "0 Updates", "class": "green"}'
fi
+37
View File
@@ -0,0 +1,37 @@
/*
*
* Catppuccin Mocha palette
* Maintainer: rubyowo
*
*/
@define-color base #1e1e2e;
@define-color mantle #181825;
@define-color crust #11111b;
@define-color text #cdd6f4;
@define-color subtext0 #a6adc8;
@define-color subtext1 #bac2de;
@define-color surface0 #313244;
@define-color surface1 #45475a;
@define-color surface2 #585b70;
@define-color overlay0 #6c7086;
@define-color overlay1 #7f849c;
@define-color overlay2 #9399b2;
@define-color blue #89b4fa;
@define-color lavender #b4befe;
@define-color sapphire #74c7ec;
@define-color sky #89dceb;
@define-color teal #94e2d5;
@define-color green #a6e3a1;
@define-color yellow #f9e2af;
@define-color peach #fab387;
@define-color maroon #eba0ac;
@define-color red #f38ba8;
@define-color mauve #cba6f7;
@define-color pink #f5c2e7;
@define-color flamingo #f2cdcd;
@define-color rosewater #f5e0dc;
+181
View File
@@ -0,0 +1,181 @@
@import "mocha.css";
* {
padding: 1px;
margin: 0px;
font-family: "Overpass", "JetBrains Mono Nerd Font";
font-size: 12px;
}
/* ------ Set a Uniform Border Radius ------ */
.modules-left, .modules-center, .modules-right, #cpu, #memory, #temperature, #pulseaudio, #backlight, #custom-spotify, #custom-icon, #custom-updates, #network, #battery, #tray, #idle_inhibitor, #custom-power, #custom-notification {
border-radius: 99px;
}
/* ------ Modules Left ------ */
.modules-left {
background-color: @base;
padding-right: 5px;
padding-left: 12px;
}
/* ------ Modules Center ------ */
.modules-center {
background-color: @base;
padding-right: 5px;
padding-left: 5px;
}
/* ------ Modules Right ------ */
.modules-right {
background-color: @base;
padding-right: 5px;
padding-left: 5px;
}
/* ------ Cpu Usage, Temperature, and Memory ------ */
#cpu, #temperature, #memory {
background-color: @surface1;
padding: 2px 5px;
margin: 4px 2px;
}
#cpu { color: @peach; }
#memory { color: @mauve; }
#temperature { color: @maroon; }
/* ------ Window Title ------ */
#window {
color: @text;
padding-right: 4px;
}
window#waybar {
background-color: rgba(0, 0, 0, 0);
border-bottom: 0px solid #ffffff;
/* color: #FFFFFF; */
background: transparent;
transition-property: background-color;
transition-duration: .5s;
}
/* -----------------------------------------------------
* Workspaces
* ----------------------------------------------------- */
#workspaces button.empty {
color: @surface2;
font-family: JetBrainsMono Nerd Font;
}
#workspaces {
margin: 0px 1px 0px 1px;
padding: 0px 12px 0px 0px;
font-family: JetBrainsMono Nerd Font;
}
#workspaces button {
padding: 0px 2px;
margin: 4px 2px;
color: @yellow;
font-family: JetBrainsMono Nerd Font;
}
#workspaces button:hover {
opacity:0.5;
}
/* ------ Pulseaudio ------ */
#pulseaudio {
color: @peach;
background-color: @surface1;
padding: 2px 8px;
margin: 4px 2px;
}
/* ------ Backlight ------ */
#backlight {
color: @sky;
background-color: @surface1;
padding: 2px 5px;
margin: 4px 2px;
}
/* ------ Network ------ */
#network {
color: @mauve;
background-color: @surface1;
padding: 2px 8px;
margin: 4px 2px;
}
/* ------ Battery ------ */
#battery {
color: @maroon;
background-color: @surface1;
padding: 2px 5px;
margin: 4px 2px;
}
/* ------ Clock ------ */
#clock {
padding-left: 10px;
color: @text;
font-weight: bold;
font-size: 13px;
}
/* ------ System Tray ------ */
#tray {
background-color: @surface1;
padding: 2px 5px;
margin: 4px 2px;
}
/* ------ Custom Modules ------ */
#custom-separator-arrow {
font-size: 14px;
color: @text;
}
#custom-separator-dot {
font-size: 15px;
color: @text;
}
#custom-spotify {
color: @mauve;
background-color: @surface1;
padding: 2px 9px;
margin: 4px 2px;
}
#custom-power {
color: @red;
background-color: @surface1;
padding: 2px 9px;
margin: 4px 2px;
font-size: 15px;
}
/*
#idle_inhibitor {
color: @green;
background-color: @surface1;
padding: 2px 9px;
margin: 4px 2px;
font-size: 15px;
}*/
#custom-notification {
color: @teal;
background-color: @surface1;
padding: 2px 9px;
margin: 4px 2px;
font-size: 15px;
}
tooltip {
background: @base;
border: 1px solid @blue;
}