init
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
include-file = ~/.config/polybar/theme.ini
|
||||
include-file = ~/.config/polybar/modules.ini
|
||||
|
||||
[bar/main]
|
||||
width = 100%
|
||||
height = 34
|
||||
offset-y = 0
|
||||
offset-x = 0
|
||||
top = true
|
||||
fixed-center = true
|
||||
padding = 1
|
||||
locale = de_DE.UTF-8
|
||||
wm-restack = bspwm
|
||||
override-redirect = false
|
||||
scroll-up = next
|
||||
scroll-down = prev
|
||||
enable-ipc = true
|
||||
background = ${colors.bg}
|
||||
foreground = ${colors.fg}
|
||||
font-0 = "Hack Nerd Font:style=Bold:size=10;2"
|
||||
font-1 = "MonarchOS:size=11;2"
|
||||
font-2 = "Hack Nerd Font:style=Regular:size=11;2"
|
||||
font-3 = "Hack Nerd Font:style=Regular:size=20;5"
|
||||
radius = 0
|
||||
tray-position = none
|
||||
tray-padding = 5
|
||||
tray-spacing = 0
|
||||
tray-background = ${colors.shade-1}
|
||||
cursor-click = pointer
|
||||
monitor = HDMI-1
|
||||
|
||||
modules-left = session date bspwm
|
||||
modules-center = windowlist
|
||||
modules-right = pulseaudio wireless-network vpn
|
||||
|
||||
[bar/external]
|
||||
inherit = bar/main
|
||||
monitor = DP-2
|
||||
modules-left = session date bspwm
|
||||
modules-center = windowlist2
|
||||
modules-right = pulseaudio wireless-network vpn gamemode updates-pacman-aurhelper
|
||||
tray-position = left
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
format-padding = 1
|
||||
pseudo-transparency = true
|
||||
@@ -0,0 +1,47 @@
|
||||
include-file = ~/.config/polybar/theme.ini
|
||||
include-file = ~/.config/polybar/modules.ini
|
||||
|
||||
[bar/main]
|
||||
width = 100%
|
||||
height = 34
|
||||
offset-y = 0
|
||||
offset-x = 0
|
||||
top = true
|
||||
fixed-center = true
|
||||
padding = 1
|
||||
locale = de_DE.UTF-8
|
||||
wm-restack = bspwm
|
||||
override-redirect = false
|
||||
scroll-up = next
|
||||
scroll-down = prev
|
||||
enable-ipc = true
|
||||
background = ${colors.bg}
|
||||
foreground = ${colors.fg}
|
||||
font-0 = "Hack Nerd Font:style=Bold:size=10;2"
|
||||
font-1 = "MonarchOS:size=11;2"
|
||||
font-2 = "Hack Nerd Font:style=Regular:size=11;2"
|
||||
font-3 = "Hack Nerd Font:style=Regular:size=20;5"
|
||||
radius = 0
|
||||
tray-position = none
|
||||
tray-padding = 5
|
||||
tray-spacing = 0
|
||||
tray-background = ${colors.shade-1}
|
||||
cursor-click = pointer
|
||||
monitor = ${env:MONITOR:}
|
||||
|
||||
modules-left = session date polywins
|
||||
modules-center = windowlist
|
||||
modules-right = pulseaudio wireless-network vpn
|
||||
|
||||
[bar/external]
|
||||
inherit = bar/main
|
||||
monitor = ${env:MONITOR:}
|
||||
modules-left = session date polywins
|
||||
modules-center = windowlist2
|
||||
modules-right = pulseaudio wireless-network vpn gamemode updates-pacman-aurhelper
|
||||
tray-position = left
|
||||
|
||||
[settings]
|
||||
screenchange-reload = true
|
||||
format-padding = 1
|
||||
pseudo-transparency = true
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#kill all polybar instances
|
||||
CPID=$(pgrep -x polybar)
|
||||
if [ -n "${CPID}" ] ; then
|
||||
kill -TERM ${CPID}
|
||||
fi
|
||||
|
||||
# add window titles & launch the bars
|
||||
# using bspc query here to get monitors in the same order bspwm sees them
|
||||
for m in $( bspc query -M --names ); do
|
||||
index=$((index + 1))
|
||||
|
||||
if [[ $index -eq 1 ]]; then
|
||||
export P_BSPWM_WINDOW_CMD_1="tail ${HOME}/.cache/bspwm_windows_1.txt"
|
||||
MONITOR=$m polybar --reload main &
|
||||
fi
|
||||
|
||||
|
||||
#if [ && [ $(xrandr -q | grep 'DP-2 connected') ]]; then
|
||||
if [[ $index -eq 2 ]]; then
|
||||
export P_BSPWM_WINDOW_CMD_2="tail ${HOME}/.cache/bspwm_windows_2.txt"
|
||||
MONITOR=$m polybar --reload external &
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
[module/nowplaying]
|
||||
type = custom/script
|
||||
tail = true
|
||||
interval = 1
|
||||
format = <label>
|
||||
exec = playerctl metadata --format "{{ artist }} - {{ title }}"
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = ADP1
|
||||
full-at = 98
|
||||
low-at = 25
|
||||
format-full-prefix =
|
||||
format-full = <label-charging>
|
||||
format-charging-prefix =
|
||||
format-charging = <label-charging>
|
||||
label-charging = %percentage:2%%
|
||||
label-charging-padding = 1
|
||||
format-charging-foreground = ${colors.fg}
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
label-discharging = %percentage%%
|
||||
label-discharging-padding = 1
|
||||
format-discharging-foreground = ${colors.fg}
|
||||
format-low = <ramp-capacity><label-discharging>
|
||||
label-low-padding = 1
|
||||
format-low-foreground = ${colors.red}
|
||||
ramp-capacity-0 = ""
|
||||
ramp-capacity-1 = ""
|
||||
ramp-capacity-2 = ""
|
||||
ramp-capacity-3 = ""
|
||||
ramp-capacity-4 = ""
|
||||
ramp-capacity-5 = ""
|
||||
poll-interval = 5
|
||||
|
||||
[module/bspwm]
|
||||
type = internal/bspwm
|
||||
|
||||
format = <label-state> <label-mode>
|
||||
label-focused =
|
||||
label-focused-foreground = ${colors.shade-5}
|
||||
label-focused-background = ${colors.shade-2}
|
||||
label-focused-padding = 2
|
||||
label-focused-underline= ${colors.shade-5}
|
||||
|
||||
label-occupied =
|
||||
label-occupied-foreground = ${colors.shade-3}
|
||||
label-occupied-background = ${colors.shade-2}
|
||||
label-occupied-padding = 2
|
||||
|
||||
label-urgent =
|
||||
label-urgent-foreground = ${colors.red}
|
||||
label-urgent-background = ${colors.shade-2}
|
||||
label-urgent-padding = 2
|
||||
|
||||
label-empty =
|
||||
label-empty-foreground = ${colors.shade-3}
|
||||
label-empty-background = ${colors.shade-2}
|
||||
label-empty-padding = 2
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 1
|
||||
time = "%a, %d. %b %H:%M"
|
||||
time-alt = %A, %d.%m.%g %H:%M:%S
|
||||
|
||||
format = <label>
|
||||
format-foreground = ${colors.fg}
|
||||
format-padding = 1
|
||||
|
||||
label = %{T1}%time%%{T-}
|
||||
label-padding = 1
|
||||
|
||||
click-right = $HOME/.config/rofi/calendar/rofi-calendar.sh
|
||||
|
||||
[module/pulseaudio]
|
||||
type = internal/pulseaudio
|
||||
use-ui-max = false
|
||||
format-volume = <label-volume>
|
||||
format-volume-background = ${colors.shade-2}
|
||||
format-volume-prefix = " "
|
||||
format-volume-prefix-foreground = ${colors.lavender}
|
||||
label-volume = %{T1}%percentage%%%{T-}
|
||||
label-volume-foreground = ${colors.lavender}
|
||||
label-volume-padding = 1
|
||||
|
||||
format-muted = <label-muted>
|
||||
format-muted-background = ${colors.shade-2}
|
||||
format-muted-prefix = " "
|
||||
format-muted-prefix-foreground = ${colors.red}
|
||||
label-muted = %{T1}%percentage%%%{T-}
|
||||
label-muted-foreground = ${colors.fg-alt}
|
||||
label-muted-padding = 1
|
||||
click-right = $HOME/.config/rofi/volume/volume.sh
|
||||
|
||||
[module/session]
|
||||
type = custom/text
|
||||
|
||||
click-left = $HOME/.config/rofi/powermenu/powermenu.sh
|
||||
click-right = $HOME/.config/rofi/launcher/launcher.sh
|
||||
content = %{T4}%{T-}
|
||||
content-foreground = ${colors.blue}
|
||||
content-padding = 1
|
||||
content-font = 2
|
||||
|
||||
[module/screenshot]
|
||||
type = custom/text
|
||||
click-left = flameshot gui
|
||||
content = %{T4} %{T-}
|
||||
content-foreground = ${colors.fg}
|
||||
content-padding = 1
|
||||
|
||||
[module/wlan]
|
||||
type = internal/network
|
||||
interface = wlan0
|
||||
interval = 1.0
|
||||
|
||||
format-connected-prefix = 直
|
||||
format-connected = <label-connected>
|
||||
label-connected = "%{A1:wifimenu:}%essid%%{A}"
|
||||
label-connected-foreground = ${colors.fg}
|
||||
label-connected-padding = 1
|
||||
|
||||
format-disconnected = <label-disconnected>
|
||||
format-disconnected-padding = 1
|
||||
label-disconnected = %{A1:wifimenu:}睊%{A}
|
||||
label-disconnected-foreground = ${colors.shade-1}
|
||||
label-disconnected-padding = 1
|
||||
|
||||
|
||||
[module/filesystem]
|
||||
type = internal/fs
|
||||
mount-0 = /
|
||||
interval = 30
|
||||
warn-percentage = 90
|
||||
format-mounted-prefix =
|
||||
label-mounted = %percentage_used%%
|
||||
label-mounted-padding = 1
|
||||
format-warn-prefix =
|
||||
format-warn = <label-warn>
|
||||
label-warn = %free%
|
||||
label-warn-padding = 1
|
||||
format-warn-foreground = ${colors.red}
|
||||
|
||||
[module/title]
|
||||
type = internal/xwindow
|
||||
label = %title:0:50:...%
|
||||
format-prefix = " "
|
||||
format-prefix-foreground = ${colors.fg}
|
||||
|
||||
|
||||
[module/notification-history]
|
||||
type = custom/text
|
||||
click-left = $HOME/.config/polybar/modules/notifications.sh
|
||||
content = %{T4}%{T-}
|
||||
content-foreground = ${colors.fg}
|
||||
content-padding = 1
|
||||
content-font = 2
|
||||
|
||||
[module/notifications]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/modules/notifications-count.sh
|
||||
click-left = $HOME/.config/polybar/modules/notifications-open.sh
|
||||
click-right = $HOME/.config/polybar/modules/notifications-close.sh
|
||||
click-middle = $HOME/.config/polybar/modules/notifications-setmode.sh
|
||||
tail = true
|
||||
format = <label>
|
||||
label = %output:0:50:...%
|
||||
|
||||
[module/spotifyctl]
|
||||
type = custom/script
|
||||
exec = $HOME/.config/polybar/modules/polybar-playerctl.sh
|
||||
click-left = playerctl --player="spotify" play
|
||||
click-right = playerctl --player="spotify" pause
|
||||
click-middle = playerctl --player="spotify" next
|
||||
double-click-left = playerctl --player="spotify" previous
|
||||
|
||||
label = %output:0:50:...%
|
||||
|
||||
[module/spotifyctl-menu]
|
||||
type = custom/menu
|
||||
expand-right = true
|
||||
|
||||
menu-0-0 = " "
|
||||
menu-0-0-exec = killall spotify
|
||||
menu-0-1 = " ﭢ "
|
||||
menu-0-1-exec = playerctl --player="spotify" previous
|
||||
menu-0-2 = " "
|
||||
menu-0-2-exec = playerctl --player="spotify" play
|
||||
menu-0-3 = " "
|
||||
menu-0-3-exec = playerctl --player="spotify" pause
|
||||
menu-0-4 = " ﭠ "
|
||||
menu-0-4-exec = playerctl --player="spotify" next
|
||||
menu-0-5 = " "
|
||||
|
||||
label-open = " "
|
||||
label-close = ""
|
||||
label-separator = " "
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
interval = 0.5
|
||||
format = <label>
|
||||
format-foreground = ${colors.fg}
|
||||
format-padding = 2
|
||||
label = " %percentage:%%"
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
label = " %percentage_used:%%"
|
||||
|
||||
; Seconds to sleep between updates
|
||||
; Default: 1
|
||||
interval = 3
|
||||
|
||||
; Default: 90
|
||||
; New in version 3.6.0
|
||||
warn-percentage = 90
|
||||
|
||||
|
||||
[module/wireless-network]
|
||||
type = internal/network
|
||||
interface = wlan0
|
||||
interval = 3.0
|
||||
unknown-as-up = true
|
||||
|
||||
format-connected-foreground = ${colors.lavender}
|
||||
format-connected-background = ${colors.shade-2}
|
||||
format-connected-padding = 2
|
||||
format-connected = %{A1:$HOME/rofi/network-manager/rofi-network-manager.sh:}<ramp-signal> <label-connected>%{A}
|
||||
label-connected = %essid%
|
||||
format-disconnected-foreground = ${colors.lavender}
|
||||
format-disconnected-padding = 1
|
||||
format-disconnected = %{A1:$HOME/rofi/network-manager/rofi-network-manager.sh:}<label-disconnected>%{A}
|
||||
label-disconnected =""
|
||||
ramp-signal-0 = ""
|
||||
ramp-signal-1 = ""
|
||||
ramp-signal-2 = ""
|
||||
ramp-signal-3 = ""
|
||||
ramp-signal-4 = ""
|
||||
ramp-signal-foreground = ${colors.lavender}
|
||||
ramp-signal-0-foreground = "#440000"
|
||||
ramp-signal-1-foreground = "#440000"
|
||||
|
||||
|
||||
[module/wired-network]
|
||||
type = internal/network
|
||||
interface = eth0
|
||||
interval = 3.0
|
||||
format-connected-foreground = ${colors.fg}
|
||||
format-connected-padding = 1
|
||||
format-connected = %{A1:$HOME/.../rofi-network-manager/rofi-network-manager.sh:}<label-connected>%{A}
|
||||
label-connected = %local_ip%
|
||||
format-disconnected-foreground = ${colors.fg-alt}
|
||||
format-disconnected-padding = 1
|
||||
format-disconnected = %{A1:$HOME/.../rofi-network-manager/rofi-network-manager.sh:}<label-disconnected>%{A}
|
||||
label-disconnected =" "
|
||||
|
||||
|
||||
[module/bluetooth]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/system-bluetooth-bluetoothctl.sh
|
||||
tail = true
|
||||
click-left = ~/.config/rofi/bluetooth/bluetooth.sh &
|
||||
|
||||
|
||||
[module/updates-pacman-aurhelper]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/updates-pacman-aurhelper.sh
|
||||
interval = 600
|
||||
format = <label>
|
||||
format-background = ${colors.shade-2}
|
||||
format-padding = 2
|
||||
|
||||
[module/gamemode]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/gamemode.sh
|
||||
interval = 2
|
||||
format = <label>
|
||||
format-background = ${colors.shade-2}
|
||||
|
||||
|
||||
|
||||
[module/ixwindow]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/ixwindow/ixwindow
|
||||
tail = true
|
||||
label-font = 3
|
||||
|
||||
|
||||
[module/windowlist]
|
||||
type = custom/script
|
||||
exec = ${env:P_BSPWM_WINDOW_CMD_1}
|
||||
interval = 0.1
|
||||
|
||||
[module/windowlist2]
|
||||
type = custom/script
|
||||
exec = ${env:P_BSPWM_WINDOW_CMD_2}
|
||||
interval = 0.1
|
||||
|
||||
|
||||
[module/bluetooth2]
|
||||
type = custom/script
|
||||
exec = ~/.config/rofi/bluetooth/bluetooth.sh --status
|
||||
interval = 1
|
||||
click-left = ~/.config/rofi/bluetooth/bluetooth.sh &
|
||||
|
||||
[module/vpn]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/nm-vpn.sh
|
||||
interval = 5
|
||||
click-left = ~/.config/rofi/nm-vpn/nm-vpn.sh &
|
||||
format-background = ${colors.shade-4}
|
||||
|
||||
[module/rofication-status]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/rofication.sh
|
||||
click-left = ~/.config/polybar/modules/rofication.sh --show &
|
||||
format-background = ${colors.shade-4}
|
||||
background = ${colors.shade-4}
|
||||
|
||||
[module/polywins]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/modules/polywins.py $MONITOR
|
||||
format = <label>
|
||||
label = %output%
|
||||
label-padding = 0
|
||||
tail = true
|
||||
format-background = ${colors.shade-2}
|
||||
format-spacing = 5
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
STATE="$(gamemoded -s)"
|
||||
|
||||
|
||||
if [[ "$STATE" != "gamemode is inactive" ]]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# Most of the code taken from
|
||||
# https://unix.stackexchange.com/questions/48860/how-to-dump-the-icon-of-a-running-x-program
|
||||
|
||||
|
||||
SIZE=16
|
||||
COLOR="#00000000"
|
||||
|
||||
wid="$2"
|
||||
# wid="$(xdotool selectwindow)"
|
||||
# class="$(bspc query -T -n "$wid" | jq -r '.client.className')"
|
||||
WM_CLASS="$(xprop -id "$wid" WM_CLASS | awk '{print $4}' | tr -d '"')"
|
||||
|
||||
name="$WM_CLASS"
|
||||
|
||||
|
||||
CACHE="$1/$name"
|
||||
|
||||
if [ -f "$CACHE.jpg" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Check if there is an icon for us in xprop,
|
||||
# so it won't break the behavior of the script
|
||||
if [ -z "$(xprop -id "$wid" | grep "Icon")" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Resize it in advance, so icons will look better, but it's not necessary, so
|
||||
# you can remove "-resize" flag if you prefer it the other way
|
||||
cmd=(convert -resize "$SIZE"x"$SIZE" -set 'filename:w' '%w' - "${name}.png")
|
||||
|
||||
split_icons() {
|
||||
xprop -id "$wid" -notype 32c _NET_WM_ICON |
|
||||
awk -v RS=', | = ' '
|
||||
NR == 1 { h = $1; i++; next }
|
||||
NR == i + 1 { x = $1; printf "%s = %s", h, x; next }
|
||||
NR == i + 2 { s = x * $1 } { printf ", %s", $1 }
|
||||
NR == i + 2 + s { i += s + 2; printf "\n" }
|
||||
'
|
||||
}
|
||||
|
||||
to_pam() {
|
||||
perl -0777 -pe '@_=/\d+/g;
|
||||
printf "P7\nWIDTH %d\nHEIGHT %d\n", splice@_,0,2;
|
||||
printf "DEPTH 4\nMAXVAL 255\nTUPLTYPE RGB_ALPHA\nENDHDR\n";
|
||||
$_=pack "N*", @_;
|
||||
s/(.)(...)/$2$1/gs'
|
||||
}
|
||||
|
||||
|
||||
|
||||
while read -r data; do to_pam <<< "$data" | "${cmd[@]}"; done < <(split_icons)
|
||||
|
||||
convert "$name.png" -background $COLOR -flatten -alpha off "$name.jpg"
|
||||
mv "$name.jpg" "$CACHE.jpg" && rm "$name.png"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
|
||||
GAP=""
|
||||
|
||||
print_info() {
|
||||
echo -n "$GAP"
|
||||
|
||||
local DESK="$(bspc query --names -D -d focused)"
|
||||
|
||||
case $DESK in
|
||||
1)
|
||||
DESKICON=""
|
||||
;;
|
||||
2)
|
||||
DESKICON=""
|
||||
;;
|
||||
3)
|
||||
DESKICON=""
|
||||
;;
|
||||
4)
|
||||
DESKICON=""
|
||||
;;
|
||||
5)
|
||||
DESKICON=""
|
||||
;;
|
||||
6)
|
||||
DESKICON=""
|
||||
;;
|
||||
7)
|
||||
DESKICON=""
|
||||
;;
|
||||
8)
|
||||
DESKICON=""
|
||||
;;
|
||||
9)
|
||||
DESKICON=""
|
||||
;;
|
||||
*)
|
||||
DESKICON=""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$1" = "Empty" ]; then
|
||||
echo "$DESKICON $(whoami)@$(uname -n) - $(uname -r)"
|
||||
else
|
||||
local wid="$1"
|
||||
|
||||
# Doesn't always work, so xprop is more realiable here
|
||||
# WM_CLASS="$(bspc query -T -n "$Node" | jq -r '.client.className')"
|
||||
local WM_CLASS="$(xprop -id "$wid" WM_CLASS | awk '{print $4}' | tr -d '"')"
|
||||
local WM_NAME="$(xprop -id $wid _NET_WM_NAME | awk -F '=' '{print $2}' | tr -d '"')"
|
||||
|
||||
case "$WM_CLASS" in
|
||||
'firefox')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
'kitty')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
'code-oss')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
'Audacious')
|
||||
echo "$DESKICON ﱘ ${WM_NAME:0:100}";;
|
||||
'io.github.celluloid_player.Celluloid')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
'Lutris')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
'discord')
|
||||
echo "$DESKICON ﭮ ${WM_NAME:0:100}";;
|
||||
'Nemo')
|
||||
echo "$DESKICON ${WM_NAME:0:100}";;
|
||||
*)
|
||||
# https://stackoverflow.com/questions/1538676/uppercasing-first-letter-of-words-using-sed
|
||||
echo "$DESKICON ${WM_NAME:0:100}" | sed -e "s/\b\(.\)/\u\1/g";;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
exists_fullscreen_node() {
|
||||
local fullscreen_nodes="$(bspc query -N -n .fullscreen.\!hidden -d "$1")"
|
||||
|
||||
if [ -n "$fullscreen_nodes" ]; then
|
||||
echo '1'
|
||||
else
|
||||
echo '0'
|
||||
fi
|
||||
}
|
||||
|
||||
process_window() {
|
||||
local desk="$2"
|
||||
local wid="$1"
|
||||
local WM_CLASS="$(xprop -id "$wid" WM_CLASS | awk '{print $4}' | tr -d '"')"
|
||||
|
||||
# If there is a fullscreen node, don't show anything,
|
||||
# since we shouldn't see it
|
||||
if [ "$(exists_fullscreen_node "$desk")" = "1" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
|
||||
|
||||
print_info "$wid"
|
||||
}
|
||||
|
||||
|
||||
is_desktop_empty() {
|
||||
local desk="$1"
|
||||
local nodes="$(bspc query -N -n .window.\!hidden -d "$desk")"
|
||||
|
||||
|
||||
if [ -n "$nodes" ]; then
|
||||
echo '0'
|
||||
else
|
||||
echo '1'
|
||||
fi
|
||||
}
|
||||
|
||||
process_desktop() {
|
||||
local desk="$1"
|
||||
local is_empty="$(is_desktop_empty "$desk")"
|
||||
|
||||
if [ "$is_empty" = "1" ]; then
|
||||
|
||||
print_info "Empty"
|
||||
fi
|
||||
}
|
||||
|
||||
bspc subscribe node_focus | while read -r Event Monitor Desktop Node
|
||||
do
|
||||
# For some reason "$Node" and "$Desktop" are not always working
|
||||
# properly with sticky windows
|
||||
Node="$(xdotool getactivewindow)"
|
||||
Desktop="$(bspc query -D -d focused)"
|
||||
|
||||
process_window "$Node" "$Desktop"
|
||||
|
||||
done &
|
||||
|
||||
bspc subscribe node_state | while read -r Event Monitor Desktop Node State Active
|
||||
do
|
||||
Node="$(xdotool getactivewindow)"
|
||||
Desktop="$(bspc query -D -d focused)"
|
||||
|
||||
if [ "$State" != "fullscreen" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
# So, if you will focus on the other windows of the same app,
|
||||
# which are not fullscreen, you will see icon
|
||||
|
||||
|
||||
if ![ "$Active" = "on" ]; then
|
||||
process_window "$Node" "$Desktop"
|
||||
fi
|
||||
|
||||
done &
|
||||
|
||||
bspc subscribe node_add | while read -r Event Monitor Desktop Ip Node
|
||||
do
|
||||
State="$(bspc query -T -n "$Node" | jq -r '.client.state')"
|
||||
done &
|
||||
|
||||
bspc subscribe node_flag | while read -r Event Monitor Desktop Node Flag Active
|
||||
do
|
||||
if [ "$Flag" = "hidden" ] && [ "$Desktop" = "$(bspc query -D -d .focused)" ]; then
|
||||
process_desktop "$Desktop"
|
||||
fi
|
||||
|
||||
done &
|
||||
|
||||
bspc subscribe node_remove | while read -r Event Monitor Desktop Node
|
||||
do
|
||||
process_desktop "$Desktop"
|
||||
|
||||
done &
|
||||
|
||||
bspc subscribe desktop_focus | while read -r Event Monitor Desktop
|
||||
do
|
||||
|
||||
if [ "$(exists_fullscreen_node "$Desktop")" = "1" ]; then
|
||||
|
||||
continue;
|
||||
fi
|
||||
|
||||
process_desktop "$Desktop"
|
||||
|
||||
done
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,148 @@
|
||||
// compilation:
|
||||
// g++ polybar-xwindow-icon.cpp -o polybar-xwindow-icon -I/usr/include/opencv4/ -lopencv_core -lopencv_videoio -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lX11
|
||||
//
|
||||
// Code is mostly copied from
|
||||
// https://stackoverflow.com/questions/54513419/putting-image-into-a-window-in-x11
|
||||
|
||||
// Some parts are taken from
|
||||
// https://stackoverflow.com/questions/57078155/draw-border-frame-using-xlib
|
||||
|
||||
|
||||
|
||||
#include <opencv2/opencv.hpp> // FOR OpenCV
|
||||
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat)
|
||||
#include <opencv2/video/video.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
#include <X11/Xlib.h> // Every Xlib program must include this
|
||||
#include <assert.h> // I include this to test return values the lazy way
|
||||
#include <unistd.h> // So we got the profile for 10 seconds
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xlib.h> // Every Xlib program must include this
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#define NIL (0) // A name for the void pointer
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
XGCValues gr_values;
|
||||
//GC gc;
|
||||
XColor color, dummy;
|
||||
|
||||
|
||||
Display *dpy = XOpenDisplay(NIL);
|
||||
//assert(dpy);
|
||||
//int screen = DefaultScreen(dpy);
|
||||
// Get some colors
|
||||
|
||||
int blackColor = BlackPixel(dpy, DefaultScreen(dpy));
|
||||
int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
|
||||
|
||||
// Create the window
|
||||
|
||||
Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 270, 6,
|
||||
24, 24, 0, whiteColor, blackColor);
|
||||
|
||||
// We want to get MapNotify events
|
||||
|
||||
XSelectInput(dpy, w, StructureNotifyMask);
|
||||
// XSelectInput(dpy, w, ExposureMask);
|
||||
long value = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
||||
|
||||
XChangeProperty(dpy, w, XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False),
|
||||
XA_ATOM, 32, PropModeReplace, (unsigned char *) &value, 1);
|
||||
|
||||
XClassHint *polybar_xwindow_icon;
|
||||
|
||||
//my_struct = malloc(sizeof(t_data));
|
||||
polybar_xwindow_icon = XAllocClassHint();
|
||||
polybar_xwindow_icon->res_name = "polybar-xwindow-icon";
|
||||
polybar_xwindow_icon->res_class = "Polybar-xwindow-icon";
|
||||
|
||||
XSetClassHint(dpy, w, polybar_xwindow_icon);
|
||||
XFree(polybar_xwindow_icon);
|
||||
|
||||
|
||||
XMapWindow(dpy, w);
|
||||
|
||||
// Wait for the MapNotify event
|
||||
|
||||
for(;;) {
|
||||
XEvent e;
|
||||
XNextEvent(dpy, &e);
|
||||
if (e.type == MapNotify)
|
||||
break;
|
||||
}
|
||||
|
||||
Window focal = w;
|
||||
|
||||
XWindowAttributes gwa;
|
||||
XGetWindowAttributes(dpy, w, &gwa);
|
||||
int wd1 = gwa.width;
|
||||
int ht1 = gwa.height;
|
||||
|
||||
|
||||
|
||||
XImage *image = XGetImage(dpy, w, 0, 0 , wd1, ht1, AllPlanes, ZPixmap);
|
||||
unsigned long rm = image->red_mask;
|
||||
unsigned long gm = image->green_mask;
|
||||
unsigned long bm = image->blue_mask;
|
||||
|
||||
Mat img(ht1, wd1, CV_8UC3); // OpenCV Mat object is initilaized
|
||||
Mat scrap = imread(argv[1]);//(wid, ht, CV_8UC3);
|
||||
resize(scrap, img, img.size(), cv::INTER_AREA);
|
||||
|
||||
for (int x = 0; x < wd1; x++)
|
||||
for (int y = 0; y < ht1 ; y++)
|
||||
{
|
||||
unsigned long pixel = XGetPixel(image,x,y);
|
||||
|
||||
Vec3b color = img.at<Vec3b>(Point(x,y));
|
||||
|
||||
|
||||
|
||||
pixel = 65536 * color[2] + 256 * color[1] + color[0];
|
||||
|
||||
XPutPixel(image, x, y, pixel);
|
||||
}
|
||||
|
||||
// namedWindow("QR", CV_WINDOW_NORMAL);
|
||||
// imshow("QR", img);
|
||||
|
||||
|
||||
GC gc = XCreateGC(dpy, w, 0, NIL);
|
||||
XPutImage(dpy, w, gc, image, 0, 0, 0, 0, wd1, ht1);
|
||||
|
||||
int run = 1;
|
||||
|
||||
while(run) {
|
||||
XEvent xe;
|
||||
XNextEvent(dpy, &xe);
|
||||
switch (xe.type) {
|
||||
case Expose:
|
||||
XPutImage(dpy, w, gc, image, 0, 0, 0, 0, wd1, ht1);
|
||||
XSetForeground(dpy, gc, color.pixel);
|
||||
XSync(dpy, False);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XDestroyWindow(dpy, w);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
|
||||
// waitKey(0);
|
||||
return 0;
|
||||
}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
vpn="$(nmcli -t -f name,type connection show --order name --active 2>/dev/null | grep vpn | head -1 | cut -d ':' -f 1)"
|
||||
|
||||
case "$1" in
|
||||
--disconnect)
|
||||
nmcli con down $vpn
|
||||
;;
|
||||
*)
|
||||
if [ -n "$vpn" ]; then
|
||||
echo "%{F#94e2d5}%{F-} $vpn"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
PLAYER="spotify"
|
||||
|
||||
|
||||
|
||||
if [ "$(pidof "$PLAYER")" != "" ];
|
||||
then
|
||||
if [ "$(playerctl --player="$PLAYER" status)" == "Playing" ];
|
||||
then
|
||||
playerctl --player="$PLAYER" pause
|
||||
else
|
||||
playerctl --player="$PLAYER" play
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
PLAYER="spotify"
|
||||
|
||||
|
||||
|
||||
if [ "$(pidof "$PLAYER")" != "" ];
|
||||
then
|
||||
echo "$(playerctl metadata --player="$PLAYER" --format "{{ artist }} - {{ title }}")"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
Executable
+571
@@ -0,0 +1,571 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
# POLYWINS.py
|
||||
|
||||
# SETTINGS
|
||||
|
||||
|
||||
name_style = None # options: upper, lower, None
|
||||
separator = " " # What to separate workspaces with
|
||||
windowlist_prefix = " " # prefix before listing windows, default is " "
|
||||
show = "window_classname"
|
||||
forbidden_classes = "Polybar Conky Gmrun Pavucontrol".casefold().split(" ")
|
||||
hide_unpopulated_desktops = False
|
||||
iconize = True
|
||||
hide_name = True # Controls whether to hide window names when an icon is present
|
||||
|
||||
char_limit = 10
|
||||
max_windows = 10
|
||||
add_spaces = "true"
|
||||
resize_increment = 16
|
||||
resize_offset = resize_increment / 2
|
||||
use_pywal = False
|
||||
|
||||
override_names = [
|
||||
" %{F#b4befe} %{F-}",
|
||||
" %{F#b4befe} %{F-}",
|
||||
" %{F#b4befe} %{F-}"
|
||||
] # Either a list containing the focused, populated and unfocused versions of workspace name, or False
|
||||
|
||||
underline = True
|
||||
highlight_active_wps = True
|
||||
|
||||
if len(sys.argv) <= 2:
|
||||
try:
|
||||
if use_pywal is not True:
|
||||
raise TypeError
|
||||
with open(os.path.expanduser("~/.cache/wal/colors")) as colors:
|
||||
colors = tuple(map(lambda x: x[:-1], colors.readlines()))
|
||||
active_text_color = colors[1]
|
||||
active_underline = colors[1] if underline is not False else None
|
||||
inactive_text_color = colors[7]
|
||||
inactive_underline = colors[7] if underline is not False else None
|
||||
|
||||
except (OSError, IndexError, TypeError):
|
||||
active_text_color = "#cdd6f4"
|
||||
active_underline = "#EB6572" if underline is not False else None
|
||||
inactive_text_color = "#9399b2"
|
||||
inactive_underline = "#C0CAF5" if underline is not False else None
|
||||
|
||||
# WINDOW LIST SETUP
|
||||
|
||||
active_left = "%{F" + active_text_color + "}"
|
||||
active_right = "%{F-} "
|
||||
inactive_left = "%{F" + inactive_text_color + "}"
|
||||
inactive_right = "%{F-}"
|
||||
# separator = "%{F" + inactive_text_color + "}" + separator + "%{F-}"
|
||||
|
||||
wps_active_left = (
|
||||
"%{F" + (inactive_text_color if highlight_active_wps is False else active_text_color) + "}"
|
||||
)
|
||||
wps_active_right = "%{F-}"
|
||||
wps_inactive_left = "%{F" + inactive_text_color + "}"
|
||||
wps_inactive_right = "%{F-}"
|
||||
if active_underline is not None:
|
||||
active_left = active_left + "%{+u}%{u" + active_underline + "}"
|
||||
active_right = "%{-u}" + active_right
|
||||
wps_active_left = "%{F" + inactive_text_color + "}%{+u}%{u" + inactive_underline + "}"
|
||||
wps_active_right = "%{-u}%{u}%{F-}"
|
||||
|
||||
if inactive_underline is not None:
|
||||
inactive_left += "%{+u}%{u" + inactive_underline + "}"
|
||||
inactive_right = "%{-u}" + inactive_right
|
||||
|
||||
on_click = " ".join(sys.argv[:2])
|
||||
monitor = sys.argv[1]
|
||||
|
||||
printf = sys.stdout.write
|
||||
|
||||
superscript = str.maketrans("0123456789", "⁰¹²³⁴⁵⁶⁷⁸⁹")
|
||||
|
||||
class_icons = {
|
||||
"alacritty": "",
|
||||
"atom": "",
|
||||
"vscode": "",
|
||||
"code": "",
|
||||
"code-oss": "",
|
||||
"neovim": "",
|
||||
"nvim": "",
|
||||
"nvim-qt": "",
|
||||
"neovide": "",
|
||||
"banshee": "",
|
||||
"blender": "",
|
||||
"chromium": "",
|
||||
"google-chrome": "",
|
||||
"cura": "",
|
||||
"darktable": "",
|
||||
"discord": "ﭮ",
|
||||
"eclipse": "",
|
||||
"emacs": "",
|
||||
"eog": "",
|
||||
"evince": "",
|
||||
"evolution": "",
|
||||
"feh": "",
|
||||
"file-roller": "ﭕ",
|
||||
"filezilla": "",
|
||||
"firefox": "",
|
||||
"firefox-esr": "",
|
||||
"firefoxdev": "",
|
||||
"navigator": "",
|
||||
"gimp": "",
|
||||
"gimp-2.8": "",
|
||||
"gnome-control-center": "",
|
||||
"gnome-terminal-server": "",
|
||||
"prusa-slicer": "",
|
||||
"gpick": "",
|
||||
"imv": "",
|
||||
"insomnia": "",
|
||||
"java": "",
|
||||
"jetbrains-idea": "",
|
||||
"jetbrains-studio": "",
|
||||
"keepassxc": "",
|
||||
"keybase": "",
|
||||
"kicad": "",
|
||||
"kitty": "",
|
||||
"st-256color": "",
|
||||
"st": "",
|
||||
"libreoffice": "",
|
||||
"lua5.1": "",
|
||||
"mpv": "",
|
||||
"mupdf": "",
|
||||
"mysql-workbench-bin": "",
|
||||
"nautilus": "",
|
||||
"nemo": "",
|
||||
"openscad": "",
|
||||
"pavucontrol": "",
|
||||
"postman": "",
|
||||
"rhythmbox": "蓼",
|
||||
"robo3t": "",
|
||||
"signal": "",
|
||||
"slack": "",
|
||||
"slic3r.pl": "",
|
||||
"spotify": "",
|
||||
"steam": "",
|
||||
"subl": "",
|
||||
"subl3": "",
|
||||
"sublime_text": "",
|
||||
"thunar": "",
|
||||
"thunderbird": "",
|
||||
"totem": "",
|
||||
"urxvt": "",
|
||||
"xfce4-terminal": "",
|
||||
"xournal": "",
|
||||
"yelp": "",
|
||||
"zenity": "",
|
||||
"zoom": "",
|
||||
"telegram": "",
|
||||
"kotatogram": "",
|
||||
"lunarclient": "",
|
||||
"viber": "",
|
||||
}
|
||||
|
||||
|
||||
def get_active_wid():
|
||||
return os.popen("bspc query -N -n .focused").read()[:-1]
|
||||
|
||||
|
||||
def ensure_len(ID, length=10):
|
||||
while len(ID) < length - 1:
|
||||
ID = "0x0" + ID[2:]
|
||||
return ID
|
||||
|
||||
|
||||
if hide_name:
|
||||
|
||||
def to_icon(name):
|
||||
try:
|
||||
return class_icons[name.lower()] + " "
|
||||
except KeyError:
|
||||
if not name.casefold().startswith("lunar client"):
|
||||
return name[:char_limit]
|
||||
else:
|
||||
return " "
|
||||
|
||||
else:
|
||||
|
||||
def to_icon(name):
|
||||
try:
|
||||
return class_icons[name.lower()] + " " + name[:char_limit]
|
||||
except KeyError:
|
||||
if not name.casefold().startswith("lunar client"):
|
||||
return name[:char_limit]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def wid_to_name(wid, cache={}):
|
||||
if not isinstance(wid, list):
|
||||
if show == "window_class":
|
||||
out = os.popen(f"xprop -id {wid} WM_CLASS 2> /dev/null").read().split('"')
|
||||
if show == "window_classname":
|
||||
out = os.popen(f"xprop -id {wid} WM_CLASS 2> /dev/null").read().split('"')[:-1][-1]
|
||||
if show == "window_title":
|
||||
out = os.popen(f"xprop -id {wid} _NET_WM_NAME 2> /dev/null").read().split('"')[1]
|
||||
if name_style == "upper":
|
||||
out = out.upper()
|
||||
elif name_style == "lower":
|
||||
out = out.lower()
|
||||
return out
|
||||
else:
|
||||
out = {}
|
||||
cached = cache.keys()
|
||||
for id in wid:
|
||||
if id not in cached:
|
||||
if show == "window_class":
|
||||
name = os.popen(f"xprop -id {id} WM_CLASS 2> /dev/null").read().split('"')[1]
|
||||
if show == "window_classname":
|
||||
name = os.popen(f"xprop -id {id} WM_CLASS 2> /dev/null").read().split('"')[-2]
|
||||
if show == "window_title":
|
||||
name = (
|
||||
os.popen(f"xprop -id {id} _NET_WM_NAME 2> /dev/null").read().split('"')[1]
|
||||
)
|
||||
if name.lower() not in forbidden_classes:
|
||||
if iconize:
|
||||
name = to_icon(name)
|
||||
try:
|
||||
out[name].append(id)
|
||||
except KeyError:
|
||||
out[name] = [id]
|
||||
cache[id] = name
|
||||
else:
|
||||
try:
|
||||
out[cache[id]].append(id)
|
||||
except KeyError:
|
||||
out[cache[id]] = [id]
|
||||
return out, cache
|
||||
|
||||
|
||||
def generate(workspaces, focused_desk, order):
|
||||
global classcache
|
||||
focused = os.popen(f"bspc query -N -m {mon_id} -n .focused").read()[
|
||||
:-1
|
||||
] # ID of the currently focused window
|
||||
for workspace_id in order:
|
||||
if (
|
||||
len(workspaces[workspace_id][0]) < hide_unpopulated_desktops
|
||||
and workspace_id != focused_desk
|
||||
):
|
||||
continue
|
||||
printf(
|
||||
"%{A1:"
|
||||
+ on_click
|
||||
+ " switch_workspace "
|
||||
+ workspace_id
|
||||
+ ":}"
|
||||
+ "%{A2:"
|
||||
+ on_click
|
||||
+ " swap_workspace "
|
||||
+ workspace_id
|
||||
+ ":}"
|
||||
+ wps_inactive_left
|
||||
|
||||
+ (workspaces[workspace_id][1] if override_names is False else (override_names[1] if len(workspaces[workspace_id][0]) else override_names[0]))
|
||||
if workspace_id != focused_desk
|
||||
else wps_active_left
|
||||
|
||||
+ (workspaces[workspace_id][1] if override_names is False else override_names[2])
|
||||
)
|
||||
if len(workspaces[workspace_id][0]) == 0:
|
||||
#printf(separator + wps_active_right + "%{A}%{A}")
|
||||
printf( wps_active_right + "%{A}%{A}")
|
||||
else:
|
||||
printf(windowlist_prefix + "%{A}%{A}")
|
||||
windows, classcache = wid_to_name(workspaces[workspace_id][0], classcache)
|
||||
win_length = len(windows.keys())
|
||||
for i, win_class in enumerate(windows.keys()):
|
||||
if i == max_windows:
|
||||
break
|
||||
wid = " ".join(windows[win_class])
|
||||
printf(
|
||||
"%{A1:"
|
||||
+ on_click
|
||||
+ " focus "
|
||||
+ wid
|
||||
+ ":}%{A2:"
|
||||
+ on_click
|
||||
+ " close "
|
||||
+ wid
|
||||
+ ":}%{A3:"
|
||||
+ on_click
|
||||
+ " slop_resize "
|
||||
+ wid
|
||||
+ ":}%{A4:"
|
||||
+ on_click
|
||||
+ " increment_size "
|
||||
+ wid
|
||||
+ ":}%{A5:"
|
||||
+ on_click
|
||||
+ " decrement_size "
|
||||
+ wid
|
||||
+ ":}"
|
||||
)
|
||||
printf(active_left if focused in windows[win_class] else inactive_left)
|
||||
# printf(separator if i == 0 else "")
|
||||
printf(
|
||||
win_class.upper()
|
||||
if name_style == "upper"
|
||||
else (win_class.lower() if name_style == "lower" else win_class)
|
||||
)
|
||||
printf(
|
||||
#(separator if i < (win_length - 1) else "")
|
||||
""
|
||||
if len(windows[win_class]) <= 1
|
||||
else str(len(windows[win_class])).translate(superscript)
|
||||
)
|
||||
printf(active_right + "%{A}%{A}%{A}%{A}%{A}")
|
||||
printf(wps_active_right)
|
||||
if len(windows.keys()) > max_windows:
|
||||
printf(f"+{len(windows.keys())-max_windows}")
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) <= 2:
|
||||
focused = ""
|
||||
command = os.popen(
|
||||
"bspc subscribe desktop_focus desktop_add desktop_rename desktop_remove desktop_swap node_add node_remove node_swap node_transfer node_focus"
|
||||
)
|
||||
global mon_id
|
||||
mon_id = os.popen(f"bspc query -M -m '{monitor}'").read()[:-1]
|
||||
workspace_order = []
|
||||
workspaces = {} # workspace ID and name pairs
|
||||
for workspace in [
|
||||
workspace[:-1] for workspace in os.popen(f"bspc query -D -m '{mon_id}'").readlines()
|
||||
]:
|
||||
workspace_order.append(workspace)
|
||||
workspaces[workspace] = (
|
||||
[
|
||||
window[:-1]
|
||||
for window in os.popen(f"bspc query -N -d {workspace} -n .window").readlines()
|
||||
],
|
||||
os.popen(f"bspc query -D -d {workspace} --names").read()[:-1],
|
||||
)
|
||||
|
||||
focused_workspace = os.popen(f"bspc query -D -m {mon_id} -d .focused").read()[
|
||||
:-1
|
||||
] # ID of the currently focused workspace
|
||||
global classcache
|
||||
classcache = {}
|
||||
try:
|
||||
generate(
|
||||
workspaces,
|
||||
focused_workspace,
|
||||
workspace_order,
|
||||
)
|
||||
printf("\n")
|
||||
sys.stdout.flush()
|
||||
except:
|
||||
workspace_order = []
|
||||
workspaces = {} # workspace ID and name pairs
|
||||
for workspace in [
|
||||
workspace[:-1] for workspace in os.popen(f"bspc query -D -m '{mon_id}'").readlines()
|
||||
]:
|
||||
workspace_order.append(workspace)
|
||||
workspaces[workspace] = (
|
||||
[
|
||||
window[:-1]
|
||||
for window in os.popen(
|
||||
f"bspc query -N -d {workspace} -n .window"
|
||||
).readlines()
|
||||
],
|
||||
os.popen(f"bspc query -D -d {workspace} --names").read()[:-1],
|
||||
)
|
||||
focused_workspace = os.popen(f"bspc query -D -m {mon_id} -d .focused").read()[
|
||||
:-1
|
||||
] # ID of the currently focused workspace
|
||||
|
||||
while True:
|
||||
update = command.readline()[:-1]
|
||||
if (
|
||||
mon_id in update
|
||||
or update.startswith("node_remove")
|
||||
or update.startswith("node_focus")
|
||||
or update.startswith("desktop_focus")
|
||||
):
|
||||
if update.startswith("node"):
|
||||
update = update[5:].split(" ")
|
||||
if update[0] == "focus":
|
||||
# global focused
|
||||
# focused = update[3]
|
||||
pass
|
||||
elif update[0] == "add":
|
||||
try:
|
||||
workspaces[update[2]][0].append(update[4])
|
||||
except KeyError:
|
||||
pass
|
||||
elif update[0] == "remove":
|
||||
classcache.pop(update[3], None)
|
||||
try:
|
||||
workspaces[update[2]][0].remove(update[3])
|
||||
except KeyError:
|
||||
continue
|
||||
elif update[0] == "swap":
|
||||
if update[1] == mon_id:
|
||||
workspaces[update[2]][0].remove(update[3])
|
||||
workspaces[update[2]][0].append(update[6])
|
||||
if update[4] == mon_id:
|
||||
workspaces[update[5]][0].remove(update[6])
|
||||
workspaces[update[5]][0].append(update[3])
|
||||
else:
|
||||
if update[1] == mon_id:
|
||||
workspaces[update[2]][0].remove(update[3])
|
||||
if update[4] == mon_id:
|
||||
workspaces[update[5]][0].append(update[3])
|
||||
else:
|
||||
update = update[8:].split(" ")
|
||||
if update[0] == "focus":
|
||||
focused_workspace = update[-1]
|
||||
elif update[0] == "add":
|
||||
workspaces[update[2]] = ([], update[-1])
|
||||
elif update[0] == "rename":
|
||||
workspaces[update[2]] = (
|
||||
[
|
||||
window[:-1]
|
||||
for window in os.popen(f"bspc query -N -d {update[2]}").readlines()
|
||||
],
|
||||
update[-1],
|
||||
)
|
||||
elif update[0] == "remove":
|
||||
workspaces.pop(update[-1], None)
|
||||
else:
|
||||
if update[1] == mon_id and update[3] == mon_id:
|
||||
index = workspace_order.index(update[4])
|
||||
workspace_order[workspace_order.index(update[2])] = update[4]
|
||||
workspace_order[index] = update[2]
|
||||
else:
|
||||
workspace_order = []
|
||||
workspaces = {} # workspace ID and name pairs
|
||||
for workspace in [
|
||||
workspace[:-1]
|
||||
for workspace in os.popen(
|
||||
f"bspc query -D -m '{mon_id}'"
|
||||
).readlines()
|
||||
]:
|
||||
workspace_order.append(workspace)
|
||||
workspaces[workspace] = (
|
||||
[
|
||||
window[:-1]
|
||||
for window in os.popen(
|
||||
f"bspc query -N -d {workspace} -n .window"
|
||||
).readlines()
|
||||
],
|
||||
os.popen(f"bspc query -D -d {workspace} --names").read()[:-1],
|
||||
)
|
||||
focused_workspace = os.popen(
|
||||
f"bspc query -D -m {mon_id} -d .focused"
|
||||
).read()[
|
||||
:-1
|
||||
] # ID of the currently focused workspace
|
||||
|
||||
try:
|
||||
generate(
|
||||
workspaces,
|
||||
focused_workspace,
|
||||
workspace_order,
|
||||
)
|
||||
printf("\n")
|
||||
sys.stdout.flush()
|
||||
except:
|
||||
workspace_order = []
|
||||
workspaces = {} # workspace ID and name pairs
|
||||
for workspace in [
|
||||
workspace[:-1]
|
||||
for workspace in os.popen(f"bspc query -D -m '{mon_id}'").readlines()
|
||||
]:
|
||||
workspace_order.append(workspace)
|
||||
workspaces[workspace] = (
|
||||
[
|
||||
window[:-1]
|
||||
for window in os.popen(
|
||||
f"bspc query -N -d {workspace} -n .window"
|
||||
).readlines()
|
||||
],
|
||||
os.popen(f"bspc query -D -d {workspace} --names").read()[:-1],
|
||||
)
|
||||
focused_workspace = os.popen(
|
||||
f"bspc query -D -m {mon_id} -d .focused"
|
||||
).read()[
|
||||
:-1
|
||||
] # ID of the currently focused workspace
|
||||
command = os.popen(
|
||||
"bspc subscribe desktop_focus desktop_add desktop_rename desktop_remove desktop_swap node_add node_remove node_swap node_transfer node_focus"
|
||||
)
|
||||
else:
|
||||
exec(sys.argv[2] + "(" + "'" + " ".join(sys.argv[3:]) + "')")
|
||||
|
||||
|
||||
def slop_resize(window):
|
||||
window = sorted(window.split(" "))
|
||||
try:
|
||||
window = window[window.index(get_active_wid())]
|
||||
except ValueError:
|
||||
window = window[0]
|
||||
os.system(
|
||||
f"""bash -c 'bspc node "{window}" -g hidden=off &
|
||||
bspc node "{window}" -g hidden=off &
|
||||
xdo hide "{window}" &
|
||||
pos="$(slop -b 2 -c 0.75,0.8,0.96.1 -f 0,%x,%y,%w,%h)"
|
||||
xdo show "{window}"
|
||||
bspc node "{window}" -t floating
|
||||
bspc node "{window}" -d focused
|
||||
wmctrl -ir "{window}" -e "$pos"
|
||||
xdo activate "{window}"'"""
|
||||
)
|
||||
|
||||
|
||||
def close(window):
|
||||
window = sorted(window.split(" "))
|
||||
try:
|
||||
window = window[window.index(get_active_wid())]
|
||||
except ValueError:
|
||||
window = window[0]
|
||||
os.system("xdo close " + window)
|
||||
|
||||
|
||||
def focus(window):
|
||||
window = sorted(window.split(" "))
|
||||
try:
|
||||
window = window[(window.index(get_active_wid()) + 1) % len(window)]
|
||||
os.system("bspc node " + window + " -g hidden=off")
|
||||
# os.system("bspc node -s " + window)
|
||||
os.system("bspc node -f " + window)
|
||||
except ValueError:
|
||||
window = window[0]
|
||||
os.system("bspc node " + window + " -g hidden=off")
|
||||
os.system("bspc node -f " + window)
|
||||
os.system("wmctrl -ia " + window)
|
||||
|
||||
|
||||
def increment_size(window):
|
||||
window = sorted(window.split(" "))
|
||||
try:
|
||||
window = window[window.index(get_active_wid())]
|
||||
except ValueError:
|
||||
window = window[0]
|
||||
os.system(f"xdo move -x -{resize_offset} -y -{resize_offset} {window}")
|
||||
os.system(f"xdo resize -w +{resize_increment} -h +{resize_increment} {window}")
|
||||
|
||||
|
||||
def decrement_size(window):
|
||||
window = sorted(window.split(" "))
|
||||
try:
|
||||
window = window[window.index(get_active_wid())]
|
||||
except ValueError:
|
||||
window = window[0]
|
||||
os.system(f"bspc node -t floating {window}")
|
||||
os.system(f"xdo move -x +{resize_offset} -y +{resize_offset} {window}")
|
||||
os.system(f"xdo resize -w -{resize_increment} -h -{resize_increment} {window}")
|
||||
|
||||
|
||||
def switch_workspace(workspace):
|
||||
os.system(f"bspc desktop -f {workspace}")
|
||||
|
||||
|
||||
def swap_workspace(workspace):
|
||||
os.system(f"bspc desktop -s {workspace}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
rofication_print() {
|
||||
status=$(rofication-status)
|
||||
if [ $status = '?' ]; then
|
||||
printf $status
|
||||
elif [ $status -gt 0 ]; then
|
||||
printf " %s" "$status"
|
||||
else
|
||||
printf ""
|
||||
fi
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
rofication_show() {
|
||||
rofication-gui
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--show)
|
||||
rofication_show
|
||||
;;
|
||||
*)
|
||||
rofication_print
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
bluetooth_print() {
|
||||
bluetoothctl | while read -r; do
|
||||
if [ "$(systemctl is-active "bluetooth.service")" = "active" ]; then
|
||||
printf ''
|
||||
|
||||
devices_paired=$(bluetoothctl devices Paired | grep Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in $devices_paired; do
|
||||
device_info=$(bluetoothctl info "$device")
|
||||
|
||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||
device_alias=$(echo "$device_info" | grep "Alias" | cut -d ' ' -f 2-)
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
counter=$((counter + 1))
|
||||
fi
|
||||
done
|
||||
|
||||
printf '\n'
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
bluetooth_toggle() {
|
||||
if bluetoothctl show | grep -q "Powered: no"; then
|
||||
bluetoothctl power on >> /dev/null
|
||||
sleep 1
|
||||
|
||||
devices_paired=$(bluetoothctl devices Paired | grep Device | cut -d ' ' -f 2)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
bluetoothctl connect "$line" >> /dev/null
|
||||
done
|
||||
else
|
||||
devices_paired=$(bluetoothctl devices Paired | grep Device | cut -d ' ' -f 2)
|
||||
echo "$devices_paired" | while read -r line; do
|
||||
bluetoothctl disconnect "$line" >> /dev/null
|
||||
done
|
||||
|
||||
bluetoothctl power off >> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
--toggle)
|
||||
bluetooth_toggle
|
||||
;;
|
||||
*)
|
||||
bluetooth_print
|
||||
;;
|
||||
esac
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
|
||||
updates_arch=0
|
||||
fi
|
||||
|
||||
# if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
|
||||
if ! updates_aur=$(paru -Qum 2> /dev/null | wc -l); then
|
||||
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
|
||||
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
|
||||
# if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
|
||||
# if ! updates_aur=$(rua upgrade --printonly 2> /dev/null | wc -l); then
|
||||
updates_aur=0
|
||||
fi
|
||||
|
||||
updates=$((updates_arch + updates_aur))
|
||||
|
||||
if [ "$updates" -gt 0 ]; then
|
||||
echo " $updates"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
wlist=$(wmctrl -lpx)
|
||||
|
||||
IFS=$'\n' read -ra ADDR -d $'\0' <<< "$wlist"
|
||||
|
||||
for win in "${ADDR[@]}"
|
||||
do
|
||||
id=$win | awk '{print $1}'
|
||||
desktop=$win | awk '{print $2}'
|
||||
pid=$win | awk '{print $3}'
|
||||
name=$win | awk '{print $4}'
|
||||
host=$win | awk '{print $5}'
|
||||
title=$win | awk '{print $6}'
|
||||
|
||||
echo $win | awk '{print $6}'
|
||||
done
|
||||
@@ -0,0 +1,47 @@
|
||||
[colors]
|
||||
bg = #181825
|
||||
bg-alt = #20212C
|
||||
fg = #acb0d0
|
||||
fg-alt = #9399b2
|
||||
|
||||
trans = #00000000
|
||||
|
||||
shade-1 = #11111b
|
||||
shade-2 = #1e1e2e
|
||||
shade-3 = #313244
|
||||
shade-4 = #45475a
|
||||
shade-5 = #585b70
|
||||
|
||||
#https://catppuccin.ryanccn.dev/palette
|
||||
rosewater = #f5e0dc
|
||||
flamingo = #f2cdcd
|
||||
pink = #f5c2e7
|
||||
mauve = #cba6f7
|
||||
red = #f38ba8
|
||||
maroon = #eba0ac
|
||||
peach = #fab387
|
||||
yellow = #f9e2af
|
||||
green = #a6e3a1
|
||||
teal = #94e2d5
|
||||
sky = #89dceb
|
||||
sapphire = #74c7ec
|
||||
blue = #89b4fa
|
||||
lavender = #b4befe
|
||||
|
||||
text = #cdd6f4
|
||||
subtext1 = #bac2de
|
||||
subtext0 = #a6adc8
|
||||
|
||||
overlay0 = #6c7086
|
||||
overlay1 = #7f849c
|
||||
overlay2 = #9399b2
|
||||
|
||||
surface0 = #313244
|
||||
surface1 = #45475a
|
||||
surface2 = #585b70
|
||||
|
||||
base = #1e1e2e
|
||||
mantle = #181825
|
||||
crust = #11111b
|
||||
|
||||
|
||||
Reference in New Issue
Block a user