Added sway and waybar config
This commit is contained in:
parent
e1b9e3eccf
commit
e93d9519b0
15 changed files with 994 additions and 0 deletions
|
@ -30,8 +30,11 @@ pre_remove() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_software() {
|
install_software() {
|
||||||
|
|
||||||
|
# Sway
|
||||||
git clone https://aur.archlinux.org/sway-git.git
|
git clone https://aur.archlinux.org/sway-git.git
|
||||||
cd sway-git
|
cd sway-git
|
||||||
makepkg
|
makepkg
|
||||||
pacman -U sway-git
|
pacman -U sway-git
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
35
stow/sway/.config/sway/autostart.sh
Executable file
35
stow/sway/.config/sway/autostart.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# ~/.config/sway/autostart.sh
|
||||||
|
# List of applications to autostart
|
||||||
|
#
|
||||||
|
|
||||||
|
function execute () {
|
||||||
|
setsid --fork $SHELL -c "${1}" &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Idle script
|
||||||
|
execute "~/.scripts/idle.sh"
|
||||||
|
|
||||||
|
# Gamma and brightness
|
||||||
|
execute "clight"
|
||||||
|
|
||||||
|
# Notification manager
|
||||||
|
execute "dunst -verbosity crit"
|
||||||
|
|
||||||
|
# Fix [Slow launch for some GTK apps](https://github.com/swaywm/sway/issues/5732)
|
||||||
|
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||||
|
|
||||||
|
# Fix JetBrain IDE's showing properly
|
||||||
|
wmname LG3
|
||||||
|
|
||||||
|
|
||||||
|
sleep 3
|
||||||
|
# --- Everything that requires tray to be active ---
|
||||||
|
|
||||||
|
# Nextcloud client
|
||||||
|
execute "nextcloud --background"
|
||||||
|
|
||||||
|
# Activity watch server & client
|
||||||
|
execute "aw-qt"
|
||||||
|
|
174
stow/sway/.config/sway/commands
Normal file
174
stow/sway/.config/sway/commands
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
#
|
||||||
|
# ~/.config/sway/commands
|
||||||
|
# Keybinds for sway
|
||||||
|
#
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
set {
|
||||||
|
$alt Mod1
|
||||||
|
$flag Mod4
|
||||||
|
$term alacritty
|
||||||
|
$notify ~/.scripts/notify.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Focus
|
||||||
|
bindsym {
|
||||||
|
$flag+h focus left
|
||||||
|
$flag+j focus down
|
||||||
|
$flag+k focus up
|
||||||
|
$flag+l focus right
|
||||||
|
|
||||||
|
$flag+Left focus left
|
||||||
|
$flag+Down focus down
|
||||||
|
$flag+Up focus up
|
||||||
|
$flag+Right focus right
|
||||||
|
|
||||||
|
$flag+m focus mode_toggle
|
||||||
|
$flag+p focus parent
|
||||||
|
}
|
||||||
|
|
||||||
|
# Move windows
|
||||||
|
bindsym {
|
||||||
|
$flag+Shift+h move left
|
||||||
|
$flag+Shift+j move down
|
||||||
|
$flag+Shift+k move up
|
||||||
|
$flag+Shift+l move right
|
||||||
|
|
||||||
|
$flag+Shift+Left move left
|
||||||
|
$flag+Shift+Down move down
|
||||||
|
$flag+Shift+Up move up
|
||||||
|
$flag+Shift+Right move right
|
||||||
|
|
||||||
|
$flag+Next move scratchpad
|
||||||
|
$flag+Prior scratchpad show
|
||||||
|
}
|
||||||
|
|
||||||
|
# Layouts
|
||||||
|
bindsym {
|
||||||
|
$flag+w layout toggle split
|
||||||
|
$flag+x layout tabbed
|
||||||
|
$flag+c split h
|
||||||
|
$flag+v split v
|
||||||
|
|
||||||
|
$flag+f floating enable, border normal 1
|
||||||
|
$flag+Shift+f floating disable, border pixel 1
|
||||||
|
|
||||||
|
$alt+Next border pixel 1 # Show window title
|
||||||
|
$alt+Prior border normal 1 # Hide window title
|
||||||
|
|
||||||
|
$flag+s sticky toggle
|
||||||
|
}
|
||||||
|
|
||||||
|
# Workspaces
|
||||||
|
set {
|
||||||
|
$ws1 "1:1"
|
||||||
|
$ws2 "2:2"
|
||||||
|
$ws3 "3:3"
|
||||||
|
$ws4 "4:4"
|
||||||
|
$ws5 "5:5"
|
||||||
|
$ws6 "6:6"
|
||||||
|
$ws7 "7:7"
|
||||||
|
$ws8 "8:8"
|
||||||
|
$ws9 "9:9"
|
||||||
|
$ws10 "10:10"
|
||||||
|
$ws11 "11:Soc"
|
||||||
|
$ws12 "12:Ent"
|
||||||
|
}
|
||||||
|
|
||||||
|
bindsym {
|
||||||
|
$flag+ampersand workspace $ws1
|
||||||
|
$flag+eacute workspace $ws2
|
||||||
|
$flag+quotedbl workspace $ws3
|
||||||
|
$flag+apostrophe workspace $ws4
|
||||||
|
$flag+parenleft workspace $ws5
|
||||||
|
$flag+section workspace $ws6
|
||||||
|
$flag+egrave workspace $ws7
|
||||||
|
$flag+exclam workspace $ws8
|
||||||
|
$flag+ccedilla workspace $ws9
|
||||||
|
$flag+agrave workspace $ws10
|
||||||
|
$flag+parenright workspace $ws11
|
||||||
|
$flag+minus workspace $ws12
|
||||||
|
|
||||||
|
$flag+Shift+ampersand move container to workspace $ws1, workspace $ws1
|
||||||
|
$flag+Shift+eacute move container to workspace $ws2, workspace $ws2
|
||||||
|
$flag+Shift+quotedbl move container to workspace $ws3, workspace $ws3
|
||||||
|
$flag+Shift+apostrophe move container to workspace $ws4, workspace $ws4
|
||||||
|
$flag+Shift+parenleft move container to workspace $ws5, workspace $ws5
|
||||||
|
$flag+Shift+section move container to workspace $ws6, workspace $ws6
|
||||||
|
$flag+Shift+egrave move container to workspace $ws7, workspace $ws7
|
||||||
|
$flag+Shift+exclam move container to workspace $ws8, workspace $ws8
|
||||||
|
$flag+Shift+ccedilla move container to workspace $ws9, workspace $ws9
|
||||||
|
$flag+Shift+agrave move container to workspace $ws10, workspace $ws10
|
||||||
|
$flag+Shift+parenright move container to workspace $ws11, workspace $ws11
|
||||||
|
$flag+Shift+minus move container to workspace $ws0, workspace $ws12
|
||||||
|
|
||||||
|
$flag+Control+j focus output 'eDP-1'
|
||||||
|
$flag+Control+h workspace prev_on_output
|
||||||
|
$flag+Control+l workspace next_on_output
|
||||||
|
$flag+Control+k focus output 'HDMI-A-1'
|
||||||
|
|
||||||
|
$flag+Control+Down focus output 'eDP-1'
|
||||||
|
$flag+Control+Left workspace prev_on_output
|
||||||
|
$flag+Control+Right workspace next_on_output
|
||||||
|
$flag+Control+Up focus output 'HDMI-A-1'
|
||||||
|
|
||||||
|
$flag+Control+Shift+j \
|
||||||
|
move container to output 'eDP-1', focus output 'eDP-1'
|
||||||
|
$flag+Control+Shift+h \
|
||||||
|
move container to workspace prev_on_output, workspace prev_on_output
|
||||||
|
$flag+Control+Shift+l \
|
||||||
|
move container to workspace next_on_output, workspace next_on_output
|
||||||
|
$flag+Control+Shift+k \
|
||||||
|
move container to output 'HDMI-A-1', focus output 'HDMI-A-1'
|
||||||
|
|
||||||
|
$flag+Control+Shift+Down \
|
||||||
|
move container to output 'eDP-1', focus output 'eDP-1'
|
||||||
|
$flag+Control+Shift+Left \
|
||||||
|
move container to workspace prev_on_output, workspace prev_on_output
|
||||||
|
$flag+Control+Shift+Right \
|
||||||
|
move container to workspace next_on_output, workspace next_on_output
|
||||||
|
$flag+Control+Shift+Up \
|
||||||
|
move container to output 'HDMI-A-1', focus output 'HDMI-A-1'
|
||||||
|
}
|
||||||
|
|
||||||
|
# System
|
||||||
|
bindsym --locked {
|
||||||
|
# Brightness
|
||||||
|
XF86MonBrightnessDown exec brightnessctl -e s 5%- && $notify -b
|
||||||
|
XF86MonBrightnessUp exec brightnessctl -e s +5% && $notify -b
|
||||||
|
|
||||||
|
# Volume control (Pulsemixer is slow!)
|
||||||
|
XF86AudioRaiseVolume exec pamixer -i 2 --set-limit 100 && $notify -v
|
||||||
|
XF86AudioLowerVolume exec pamixer -d 2 && $notify -v
|
||||||
|
XF86AudioMute exec pamixer -t && $notify -v
|
||||||
|
XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||||
|
|
||||||
|
# Media control
|
||||||
|
F7 exec playerctl play-pause
|
||||||
|
Shift+XF86AudioLowerVolume exec playerctl previous
|
||||||
|
Shift+XF86AudioRaiseVolume exec playerctl next
|
||||||
|
}
|
||||||
|
|
||||||
|
# Special commands
|
||||||
|
set $fzf ~/.scripts/fzf-jump
|
||||||
|
bindsym {
|
||||||
|
# Reload sway
|
||||||
|
$alt+Shift+r reload
|
||||||
|
# Dialog to exit sway
|
||||||
|
$alt+Shift+e exec swaynag -t warning -m 'Do you really want to exit sway?' \
|
||||||
|
-B 'Yes, exit sway' 'swaymsg exit'
|
||||||
|
|
||||||
|
$flag+q kill # Kill focused window
|
||||||
|
$flag+Return exec $term -e bash -c "zellij attach || zellij" # Start a terminal
|
||||||
|
$flag+Delete exec swaylock # Lockscreen
|
||||||
|
|
||||||
|
# Start application launcher
|
||||||
|
$alt+space exec $term --title 'FZF-Jump' -e $fzf/launcher.sh
|
||||||
|
# Window switcher
|
||||||
|
$alt+Tab exec $term --title 'FZF-Jump' -e $fzf/standalone.sh $fzf/modules/windows.sh $fzf/modules/workspaces.sh
|
||||||
|
|
||||||
|
# File explorer
|
||||||
|
$flag+e exec $term -e vifm
|
||||||
|
# Internet explorer
|
||||||
|
$flag+i exec firefox
|
||||||
|
}
|
58
stow/sway/.config/sway/config
Normal file
58
stow/sway/.config/sway/config
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#
|
||||||
|
# .config/sway/config
|
||||||
|
# Personal config for sway
|
||||||
|
# Requires noto-fonts-cjk
|
||||||
|
#
|
||||||
|
|
||||||
|
# Import other config files
|
||||||
|
include {
|
||||||
|
commands
|
||||||
|
modes
|
||||||
|
style
|
||||||
|
}
|
||||||
|
|
||||||
|
# Input
|
||||||
|
input type:keyboard {
|
||||||
|
xkb_layout "be"
|
||||||
|
}
|
||||||
|
|
||||||
|
input 2:7:SynPS/2_Synaptics_TouchPad {
|
||||||
|
natural_scroll enabled
|
||||||
|
scroll_factor 0.6
|
||||||
|
middle_emulation enabled
|
||||||
|
tap enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
seat seat0 hide_cursor when-typing enable
|
||||||
|
|
||||||
|
# Output
|
||||||
|
output * {
|
||||||
|
bg "~/Pictures/wallpapers/bg.*" fill
|
||||||
|
}
|
||||||
|
|
||||||
|
output 'Dell Inc. DELL P2214H 29C2937M4YTL' {
|
||||||
|
# Vertical monitor
|
||||||
|
transform 270
|
||||||
|
}
|
||||||
|
|
||||||
|
output 'Samsung Electric Company SAMSUNG 0x00000001' {
|
||||||
|
# Zoom in because long distance
|
||||||
|
scale 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Focus
|
||||||
|
focus_follows_mouse no
|
||||||
|
floating_modifier Mod4 normal
|
||||||
|
|
||||||
|
# Window rules
|
||||||
|
for_window [window_role="pop-up"] floating enable
|
||||||
|
for_window [window_role="task_dialog"] floating enable
|
||||||
|
|
||||||
|
for_window [class="Qalculate"] floating enable
|
||||||
|
for_window [class="Caprine"] floating enable, border normal 2
|
||||||
|
for_window [title="^FZF-Jump$"] floating enable, border pixel 0, resize set 600 350
|
||||||
|
|
||||||
|
for_window [class="^Betterbird$"] move container to workspace "11:Soc"
|
||||||
|
|
||||||
|
exec "~/.config/sway/autostart.sh"
|
||||||
|
|
93
stow/sway/.config/sway/modes
Normal file
93
stow/sway/.config/sway/modes
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
#
|
||||||
|
# ~/.config/sway/modes
|
||||||
|
# Modes for sway
|
||||||
|
#
|
||||||
|
|
||||||
|
set {
|
||||||
|
$alt Mod1
|
||||||
|
$flag Mod4
|
||||||
|
}
|
||||||
|
|
||||||
|
# Resizing
|
||||||
|
bindsym $flag+r mode "resize"
|
||||||
|
mode "resize" bindsym {
|
||||||
|
l resize grow width 10 px or 10 ppt
|
||||||
|
k resize grow height 10 px or 10 ppt
|
||||||
|
h resize shrink width 10 px or 10 ppt
|
||||||
|
j resize shrink height 10 px or 10 ppt
|
||||||
|
|
||||||
|
Shift+l resize grow width 50 px or 50 ppt
|
||||||
|
Shift+k resize grow height 50 px or 50 ppt
|
||||||
|
Shift+h resize shrink width 50 px or 50 ppt
|
||||||
|
Shift+j resize shrink height 50 px or 50 ppt
|
||||||
|
|
||||||
|
Right resize grow width 10 px or 10 ppt
|
||||||
|
Up resize grow height 10 px or 10 ppt
|
||||||
|
Left resize shrink width 10 px or 10 ppt
|
||||||
|
Down resize shrink height 10 px or 10 ppt
|
||||||
|
|
||||||
|
Shift+Right resize grow width 50 px or 50 ppt
|
||||||
|
Shift+Up resize grow height 50 px or 50 ppt
|
||||||
|
Shift+Left resize shrink width 50 px or 50 ppt
|
||||||
|
Shift+Down resize shrink height 50 px or 50 ppt
|
||||||
|
|
||||||
|
$flag+h move left
|
||||||
|
$flag+j move down
|
||||||
|
$flag+k move up
|
||||||
|
$flag+l move right
|
||||||
|
|
||||||
|
$flag+Left move left
|
||||||
|
$flag+Down move down
|
||||||
|
$flag+Up move up
|
||||||
|
$flag+Right move right
|
||||||
|
|
||||||
|
Return mode "default"
|
||||||
|
Escape mode "default"
|
||||||
|
$flag+r mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
# System actions
|
||||||
|
set $mode_system System (l)ock, (s)leep, (h)ibernate, (r)eboot, (Shift+s)hutdown
|
||||||
|
bindsym Control+$alt+Delete mode "$mode_system"
|
||||||
|
mode "$mode_system" bindsym {
|
||||||
|
l exec swaylock, mode "default"
|
||||||
|
s exec systemctl suspend, mode "default"
|
||||||
|
h exec systemctl hibernate, mode "default"
|
||||||
|
r exec systemctl reboot, mode "default"
|
||||||
|
Shift+s exec systemctl poweroff -i, mode "default"
|
||||||
|
|
||||||
|
Return mode "default"
|
||||||
|
Escape mode "default"
|
||||||
|
Control+$alt+Delete mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Screenshots
|
||||||
|
set $mode_screenshot Screenshot of (a)rea, current (w)indow, (s)creen - Shift to save
|
||||||
|
set $save_format ~/Pictures/Screenshots/$(date +%F-%H-%M-%S).png
|
||||||
|
bindsym Print mode "$mode_screenshot"
|
||||||
|
mode "$mode_screenshot" bindsym {
|
||||||
|
a exec grimshot copy area, mode "default"
|
||||||
|
w exec grimshot --notify copy active, mode "default"
|
||||||
|
s exec grimshot --notify copy screen, mode "default"
|
||||||
|
|
||||||
|
Print exec grimshot --notify save screen $save_format mode "default" # Super fast screens!
|
||||||
|
Shift+a exec grimshot --notify save area $save_format, mode "default"
|
||||||
|
Shift+w exec grimshot --notify save active $save_format, mode "default"
|
||||||
|
Shift+s exec grimshot --notify save screen $save_format, mode "default"
|
||||||
|
|
||||||
|
Return mode "default"
|
||||||
|
Escape mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Some preferences
|
||||||
|
set $mode_preferences Toggle (s)unset, (n)otifications, (f)ocus
|
||||||
|
bindsym $alt+end mode "$mode_preferences"
|
||||||
|
mode "$mode_preferences" bindsym {
|
||||||
|
s exec "~/.scripts/wlsunset.sh", mode "default"
|
||||||
|
n exec "~/.scripts/dnd.sh", mode "default"
|
||||||
|
f exec "~/.scripts/focus.sh", mode "default"
|
||||||
|
|
||||||
|
Return mode "default"
|
||||||
|
Escape mode "default"
|
||||||
|
$alt+end mode "default"
|
||||||
|
}
|
27
stow/sway/.config/sway/style
Normal file
27
stow/sway/.config/sway/style
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#
|
||||||
|
# ~/.config/sway/style
|
||||||
|
# Styling for sway
|
||||||
|
#
|
||||||
|
|
||||||
|
# Decrease the height of the window bar thing.
|
||||||
|
font pango:monospace 1
|
||||||
|
|
||||||
|
bar {
|
||||||
|
swaybar_command /usr/bin/waybar
|
||||||
|
mode hide
|
||||||
|
}
|
||||||
|
|
||||||
|
default_border pixel 1
|
||||||
|
default_floating_border normal 1
|
||||||
|
hide_edge_borders both
|
||||||
|
smart_borders on
|
||||||
|
|
||||||
|
# Mimic no titles
|
||||||
|
# border backgr. text indic. child_border
|
||||||
|
client.focused #000000 #00897b #00897b #00897b #000000
|
||||||
|
client.focused_inactive #000000 #222222 #222222 #222222 #000000
|
||||||
|
client.unfocused #000000 #222222 #222222 #222222 #000000
|
||||||
|
client.urgent #ff0000 #ff0000 #ff0000 #ff0000 #ff0000
|
||||||
|
|
||||||
|
exec gsettings set org.gnome.desktop.interface icon-theme 'IcoSystem'
|
||||||
|
exec gsettings set org.gnome.desktop.interface gtk-theme 'Nordic'
|
45
stow/waybar/.config/waybar/config
Normal file
45
stow/waybar/.config/waybar/config
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// ~/.config/waybar/config
|
||||||
|
//
|
||||||
|
|
||||||
|
[{
|
||||||
|
|
||||||
|
"name": "toggle",
|
||||||
|
|
||||||
|
"mode": "hide",
|
||||||
|
"ipc": true,
|
||||||
|
|
||||||
|
"position": "top",
|
||||||
|
"height": 25,
|
||||||
|
"spacing": 4,
|
||||||
|
"margin": "-25px 0 0 0", // Show this bar on top of the other one, seemingly the "same" one.
|
||||||
|
|
||||||
|
"custom/sep": {
|
||||||
|
"format": "\uf142"
|
||||||
|
},
|
||||||
|
|
||||||
|
"include": [
|
||||||
|
// Import modules (!)
|
||||||
|
"~/.config/waybar/modules.json",
|
||||||
|
// "~/.config/waybar/default.json"
|
||||||
|
"~/.config/waybar/left.json"
|
||||||
|
],
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
"name": "keep",
|
||||||
|
"position": "top",
|
||||||
|
"height": 25,
|
||||||
|
"modules-left": ["sway/mode", "custom/browser"],
|
||||||
|
"modules-center": ["sway/window"],
|
||||||
|
"modules-right": ["clock"],
|
||||||
|
|
||||||
|
"include": [
|
||||||
|
// Import modules (!)
|
||||||
|
"~/.config/waybar/modules.json"
|
||||||
|
],
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
24
stow/waybar/.config/waybar/default.json
Normal file
24
stow/waybar/.config/waybar/default.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
|
||||||
|
{
|
||||||
|
"modules-left": [
|
||||||
|
"idle_inhibitor",
|
||||||
|
"custom/media"
|
||||||
|
],
|
||||||
|
"modules-center": [
|
||||||
|
"sway/workspaces"
|
||||||
|
],
|
||||||
|
"modules-right": [
|
||||||
|
"disk",
|
||||||
|
"memory",
|
||||||
|
"cpu",
|
||||||
|
"temperature",
|
||||||
|
"custom/sep",
|
||||||
|
"bluetooth",
|
||||||
|
"network",
|
||||||
|
"pulseaudio",
|
||||||
|
"battery",
|
||||||
|
"custom/sep",
|
||||||
|
"tray"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
19
stow/waybar/.config/waybar/left.json
Normal file
19
stow/waybar/.config/waybar/left.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"modules-left": [
|
||||||
|
"sway/workspaces",
|
||||||
|
"idle_inhibitor",
|
||||||
|
"custom/media"
|
||||||
|
],
|
||||||
|
"modules-right": [
|
||||||
|
"memory",
|
||||||
|
"cpu",
|
||||||
|
"temperature",
|
||||||
|
"custom/sep",
|
||||||
|
"bluetooth",
|
||||||
|
"network",
|
||||||
|
"pulseaudio",
|
||||||
|
"battery",
|
||||||
|
"custom/sep",
|
||||||
|
"tray"
|
||||||
|
]
|
||||||
|
}
|
131
stow/waybar/.config/waybar/mediaplayer.py
Executable file
131
stow/waybar/.config/waybar/mediaplayer.py
Executable file
|
@ -0,0 +1,131 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# From:
|
||||||
|
# https://github.com/Alexays/Waybar/blob/master/resources/custom_modules/mediaplayer.py
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import signal
|
||||||
|
import gi
|
||||||
|
import json
|
||||||
|
gi.require_version('Playerctl', '2.0')
|
||||||
|
from gi.repository import Playerctl, GLib
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def write_output(text, player):
|
||||||
|
logger.info('Writing output')
|
||||||
|
|
||||||
|
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 on_play(player, status, manager):
|
||||||
|
logger.info('Received new playback status')
|
||||||
|
on_metadata(player, player.props.metadata, manager)
|
||||||
|
|
||||||
|
|
||||||
|
def on_metadata(player, metadata, manager):
|
||||||
|
logger.info('Received new metadata')
|
||||||
|
track_info = ''
|
||||||
|
|
||||||
|
if player.props.player_name == 'spotify' and \
|
||||||
|
'mpris:trackid' in metadata.keys() and \
|
||||||
|
':ad:' in player.props.metadata['mpris:trackid']:
|
||||||
|
track_info = 'AD PLAYING'
|
||||||
|
elif player.get_artist() != '' and player.get_title() != '':
|
||||||
|
track_info = '{artist} - {title}'.format(artist=player.get_artist(),
|
||||||
|
title=player.get_title())
|
||||||
|
else:
|
||||||
|
track_info = player.get_title()
|
||||||
|
|
||||||
|
if player.props.status != 'Playing' and track_info:
|
||||||
|
track_info = ' ' + track_info
|
||||||
|
write_output(track_info, player)
|
||||||
|
|
||||||
|
|
||||||
|
def on_player_appeared(manager, player, selected_player=None):
|
||||||
|
if player is not None and (selected_player is None or player.name == selected_player):
|
||||||
|
init_player(manager, player)
|
||||||
|
else:
|
||||||
|
logger.debug("New player appeared, but it's not the selected player, skipping")
|
||||||
|
|
||||||
|
|
||||||
|
def on_player_vanished(manager, player):
|
||||||
|
logger.info('Player has vanished')
|
||||||
|
sys.stdout.write('\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def init_player(manager, name):
|
||||||
|
logger.debug('Initialize player: {player}'.format(player=name.name))
|
||||||
|
player = Playerctl.Player.new_from_name(name)
|
||||||
|
player.connect('playback-status', on_play, manager)
|
||||||
|
player.connect('metadata', on_metadata, manager)
|
||||||
|
manager.manage_player(player)
|
||||||
|
on_metadata(player, player.props.metadata, manager)
|
||||||
|
|
||||||
|
|
||||||
|
def signal_handler(sig, frame):
|
||||||
|
logger.debug('Received signal to stop, exiting')
|
||||||
|
sys.stdout.write('\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
# loop.quit()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
arguments = parse_arguments()
|
||||||
|
|
||||||
|
# Initialize logging
|
||||||
|
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG,
|
||||||
|
format='%(name)s %(levelname)s %(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))
|
||||||
|
|
||||||
|
# Log the sent command line arguments
|
||||||
|
logger.debug('Arguments received {}'.format(vars(arguments)))
|
||||||
|
|
||||||
|
manager = Playerctl.PlayerManager()
|
||||||
|
loop = GLib.MainLoop()
|
||||||
|
|
||||||
|
manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player))
|
||||||
|
manager.connect('player-vanished', on_player_vanished)
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
|
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
|
|
||||||
|
for player in manager.props.player_names:
|
||||||
|
if arguments.player is not None and arguments.player != player.name:
|
||||||
|
logger.debug('{player} is not the filtered player, skipping it'
|
||||||
|
.format(player=player.name)
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
|
init_player(manager, player)
|
||||||
|
|
||||||
|
loop.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
156
stow/waybar/.config/waybar/modules.json
Normal file
156
stow/waybar/.config/waybar/modules.json
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
{
|
||||||
|
|
||||||
|
"battery": {
|
||||||
|
"format": "{capacity}% {icon}",
|
||||||
|
"format-alt": "{time} {icon}",
|
||||||
|
"format-charging": "{capacity}% \uf0e7 {icon}",
|
||||||
|
"format-icons": ["\uf244", "\uf243", "\uf242", "\uf241", "\uf240"],
|
||||||
|
"format-plugged": "{capacity}% \ue55c",
|
||||||
|
"states": {
|
||||||
|
"warning": 30,
|
||||||
|
"critical": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"disk": {
|
||||||
|
"interval": 30,
|
||||||
|
"format": "{percentage_used}% \uf0a0",
|
||||||
|
"on-click": "alacritty -e ncdu /",
|
||||||
|
"path": "/",
|
||||||
|
"tooltip-format": "{used} used out of {total} on {path} ({percentage_free}% or {free} free)"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"bluetooth": {
|
||||||
|
"format-disabled": "<big>\uf294</big>",
|
||||||
|
"format-off": "\uf294",
|
||||||
|
"format-on": "<big>\uf294</big>",
|
||||||
|
"format-connected": "<big>\uf294</big>c",
|
||||||
|
"max-length": 10.3,
|
||||||
|
"on-click": "alacritty --title 'FZF-Jump' -e ~/.scripts/fzf-jump/standalone.sh ~/.scripts/fzf-jump/modules/bluetooth.sh",
|
||||||
|
"tooltip-format": "{status}",
|
||||||
|
"tooltip-format-on": "{status}, no devices connected",
|
||||||
|
"tooltip-format-connected": "{status} ({num_connections}):\n{device_enumerate}",
|
||||||
|
"tooltip-format-enumerate-connected": "{device_alias} ({device_address})",
|
||||||
|
"tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"clock": {
|
||||||
|
"format": "{:%H:%M}",
|
||||||
|
"format-alt": "{:%d/%m/%Y %H:%M}",
|
||||||
|
"timezone": "Europe/Brussels",
|
||||||
|
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"custom/browser": {
|
||||||
|
"format": "\uf120",
|
||||||
|
"on-click": "alacritty -t 'FZF-Jump' -e ~/.scripts/fzf-jump/launcher.sh",
|
||||||
|
"tooltip-format": "Launch an application"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"custom/media": {
|
||||||
|
"escape": true,
|
||||||
|
"exec": "~/.config/waybar/mediaplayer.py 2> /dev/null",
|
||||||
|
"format": "{icon} {}",
|
||||||
|
"format-icons": {
|
||||||
|
"default": "\uf51f",
|
||||||
|
"spotify": "\uf1bc"
|
||||||
|
},
|
||||||
|
"max-length": 40,
|
||||||
|
"on-click": "playerctl play-pause",
|
||||||
|
"return-type": "json"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"cpu": {
|
||||||
|
"format": "{usage}% \uf2db",
|
||||||
|
"on-click": "alacritty -e htop",
|
||||||
|
"tooltip": true
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"idle_inhibitor": {
|
||||||
|
"format": "{icon}",
|
||||||
|
"format-icons": {
|
||||||
|
"activated": "\uf06e",
|
||||||
|
"deactivated": "\uf070"
|
||||||
|
},
|
||||||
|
"tooltip": false
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"memory": {
|
||||||
|
"format": "{}% \uf1c0",
|
||||||
|
"on-click": "alacritty -e htop"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"network": {
|
||||||
|
"format-disconnected": "\uf127",
|
||||||
|
"format-ethernet": "\uf6ff {ifname}: {ipadds}/{cidr}",
|
||||||
|
"format-wifi": "\uf1eb",
|
||||||
|
"interval": 5,
|
||||||
|
"on-click-right": "alacritty -e nmtui",
|
||||||
|
"tooltip-format": "{ifname}: {ipaddr}",
|
||||||
|
"tooltip-format-disconnected": "Disconnected",
|
||||||
|
"tooltip-format-wifi": "{essid} ({signalStrength}%)\n{ifname}: {ipaddr}"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"sway/window": {
|
||||||
|
"max-length": 85
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"sway/workspaces": {
|
||||||
|
"all-outputs": false,
|
||||||
|
"disable-scroll": true,
|
||||||
|
"format": "{icon}{name}",
|
||||||
|
"format-icons": {
|
||||||
|
"default": "", // Prevent showing workspace name literal.
|
||||||
|
"urgent": "\uf071 "
|
||||||
|
},
|
||||||
|
// "persistent_workspaces": {
|
||||||
|
// "0:¯\\_(ツ)_/¯": []
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"pulseaudio": {
|
||||||
|
"format": "{volume}% {icon}{format_source}",
|
||||||
|
"format-bluetooth": "{volume}% {icon}\uf294{format_source}",
|
||||||
|
"format-bluetooth-muted": "\uf6a9 {icon}\uf294{format_source}",
|
||||||
|
"format-muted": "\uf6a9{format_source}",
|
||||||
|
"format-source": " {volume}% \uf130",
|
||||||
|
"format-source-muted": "",
|
||||||
|
"format-icons": {
|
||||||
|
"headphone": "\uf58f",
|
||||||
|
"hands-free": "\uf590",
|
||||||
|
"headset": "\uf590",
|
||||||
|
"phone": "\uf3ce",
|
||||||
|
"portable": "\uf3ce",
|
||||||
|
"car": "\uf1b9",
|
||||||
|
"default": ["\uf026", "\uf027", "\uf028 "]
|
||||||
|
},
|
||||||
|
"on-click": "pulsemixer --toggle-mute",
|
||||||
|
"on-click-right": "pavucontrol",
|
||||||
|
"scroll-step": 2
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"temperature": {
|
||||||
|
"critical-threshold": 70,
|
||||||
|
"format": "{temperatureC}°C {icon}",
|
||||||
|
"format-icons": ["\uf2cb", "\uf2c9", "\uf2c7"]
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"tray": {
|
||||||
|
"spacing": 10
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
stow/waybar/.config/waybar/round.css
Normal file
50
stow/waybar/.config/waybar/round.css
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* ~/.config/waybar/round.css
|
||||||
|
*
|
||||||
|
* This stylesheet has round modules and titles.
|
||||||
|
*/
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
color: @white;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-left {
|
||||||
|
background-color: @transparent-black;
|
||||||
|
border-radius: 0 20px 20px 0;
|
||||||
|
/* Coloured modules must hit the border! */
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-center {
|
||||||
|
background-color: @transparent-black;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.keep .modules-center {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-right {
|
||||||
|
background-color: @transparent-black;
|
||||||
|
border-radius: 20px 0 0 20px;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button {
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button:hover,
|
||||||
|
#workspaces button.focused {
|
||||||
|
background-color: @accent;
|
||||||
|
border-radius: 20px;
|
||||||
|
color: @white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-media {
|
||||||
|
border-radius: 0 20px 20px 0;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
23
stow/waybar/.config/waybar/sharp.css
Normal file
23
stow/waybar/.config/waybar/sharp.css
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* ~/.config/waybar/sharp.css
|
||||||
|
*
|
||||||
|
* This stylesheet is a take on a minimal layout.
|
||||||
|
*/
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
color: @white;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mode,
|
||||||
|
.toggle .modules-left,
|
||||||
|
.toggle .modules-right {
|
||||||
|
background-color: @transparent-black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#mode,
|
||||||
|
#workspaces button.focused,
|
||||||
|
#workspaces button:hover {
|
||||||
|
box-shadow: inset 0 2px #ffffff;
|
||||||
|
}
|
||||||
|
|
132
stow/waybar/.config/waybar/style.css
Normal file
132
stow/waybar/.config/waybar/style.css
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* ~/.config/waybar/style.css
|
||||||
|
*
|
||||||
|
* `otf-font-awesome` is required to be installed for icons.
|
||||||
|
*
|
||||||
|
* Pick your stylesheet:
|
||||||
|
* - sharp.css
|
||||||
|
* - transparent.css
|
||||||
|
* - round.css
|
||||||
|
*/
|
||||||
|
|
||||||
|
@define-color transparent-black rgba(23, 23, 23, 0.9);
|
||||||
|
@define-color white #ecf0f1;
|
||||||
|
@define-color warning-red #eb4d4b;
|
||||||
|
@define-color accent #00897b;
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
font-family: Letter; /* This is my personal font. */
|
||||||
|
font-size: 13px;
|
||||||
|
transition-property: background-color;
|
||||||
|
transition-duration: .5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#window, #workspaces {
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
min-width: 30px;
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button:hover,
|
||||||
|
#workspaces button.focused {
|
||||||
|
background-color: transparent;
|
||||||
|
color: @white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button.urgent {
|
||||||
|
color: @white;
|
||||||
|
background-color: @warning-red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* All modules individually. */
|
||||||
|
#backlight, #battery, #bluetooth, #clock, #cpu,
|
||||||
|
#custom-browser, #custom-media, #disk, #idle_inhibitor,
|
||||||
|
#memory, #mode, #mpd, #network, #pulseaudio,
|
||||||
|
#temperature, #tray {
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If workspaces is the leftmost module, omit left margin */
|
||||||
|
.modules-left > widget:first-child > #workspaces {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If workspaces is the rightmost module, omit right margin */
|
||||||
|
.modules-right > widget:last-child > #workspaces {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
to {
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label:focus {
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Module specific colours */
|
||||||
|
|
||||||
|
#battery.charging, #battery.plugged {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #26A65B;
|
||||||
|
}
|
||||||
|
|
||||||
|
#battery.critical:not(.charging) {
|
||||||
|
background-color: #f53c3c;
|
||||||
|
color: #ffffff;
|
||||||
|
animation-name: blink;
|
||||||
|
animation-duration: 0.5s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-direction: alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bluetooth.disabled,
|
||||||
|
#bluetooth.off,
|
||||||
|
#network.disconnected,
|
||||||
|
#pulseaudio.muted {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-media {
|
||||||
|
color: #2a5c45;
|
||||||
|
background-color: #66cc99;
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-media.custom-spotify {
|
||||||
|
background-color: #66cc99;
|
||||||
|
}
|
||||||
|
|
||||||
|
#custom-media.custom-vlc {
|
||||||
|
background-color: #ffa000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#temperature.critical {
|
||||||
|
background-color: #eb4d4b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#idle_inhibitor.activated {
|
||||||
|
background-color: #ecf0f1;
|
||||||
|
color: #2d3436;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tray > .passive {
|
||||||
|
-gtk-icon-effect: dim;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tray > .needs-attention {
|
||||||
|
-gtk-icon-effect: highlight;
|
||||||
|
background-color: #eb4d4b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import "sharp.css";
|
||||||
|
|
24
stow/waybar/.config/waybar/transparent.css
Normal file
24
stow/waybar/.config/waybar/transparent.css
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* ~/.config/waybar/transparent.css
|
||||||
|
*
|
||||||
|
* This stylesheet is a minimalistic, transparent style.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@define-color transparent-black-light rgba(23, 23, 23, 0.7);
|
||||||
|
|
||||||
|
window#waybar {
|
||||||
|
color: @white;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle .modules-right,
|
||||||
|
.toggle .modules-left {
|
||||||
|
background-color: @transparent-black-light;
|
||||||
|
}
|
||||||
|
|
||||||
|
#workspaces button:hover,
|
||||||
|
#workspaces button.focused,
|
||||||
|
#mode {
|
||||||
|
box-shadow: inset 0 2px #ffffff;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue