Added clipboard manager and fix battery module on Polybar

This commit is contained in:
Fabio Scotto di Santolo
2025-09-07 22:32:39 +02:00
parent 9e70682bd3
commit ad83e5a63a
5 changed files with 175 additions and 16 deletions

View File

@@ -19,6 +19,10 @@ set $right l
set $term 'alacritty' set $term 'alacritty'
set $editor 'emacs' set $editor 'emacs'
set $filemanager 'nemo'
set $notification 'dunst'
set $browser 'org.mozilla.firefox'
set $clipboard 'diodon'
# Define names for default workspaces for which we configure key bindings later on. # Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places. # We use variables to avoid repeating the names in multiple places.
@@ -113,12 +117,13 @@ for_window [class="Webconsole"] floating enable
for_window [class="Authy"] floating enable for_window [class="Authy"] floating enable
for_window [class="Termfloat"] floating enable, resize set 960 540 for_window [class="Termfloat"] floating enable, resize set 960 540
for_window [class="Mpv"] floating enable, resize set 960 540 for_window [class="Mpv"] floating enable, resize set 960 540
for_window [class="Spotify"] floating enable, move scratchpad for_window [class="Spotify"] floating enable, resize set 1280 1024, move scratchpad
# Workspaces # Workspaces
assign [class="Emacs"] 1 assign [class="Emacs"] 1
assign [class="firefox"] 2 assign [class="firefox"] 2
assign [class="Telegram"] 3 assign [class="Telegram"] 3
assign [class="discord"] 3
focus_follows_mouse no focus_follows_mouse no
@@ -151,10 +156,11 @@ mode "launcher" {
} }
bindsym $mod+d mode "launcher" bindsym $mod+d mode "launcher"
bindsym $mod+Shift+f exec "nemo"
bindsym $mod+Shift+b exec "flatpak run org.mozilla.firefox" bindsym $mod+Shift+b exec "flatpak run org.mozilla.firefox"
bindsym $mod+Shift+t exec "flatpak run org.telegram.desktop" bindsym $mod+Shift+t exec "flatpak run org.telegram.desktop"
bindsym Print exec flameshot gui bindsym Print exec flameshot gui
# bindsym $mod+Shift+v exec xfce4-clipman-history bindsym $mod+Shift+v exec --no-startup-id $clipboard
# Use pactl to adjust volume in PulseAudio. # Use pactl to adjust volume in PulseAudio.
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%
@@ -312,19 +318,21 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
# Polkit Authentication agent # Polkit Authentication agent
exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 exec_always --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
### Apply wallpaper ### Apply wallpaper
exec_always feh --bg-scale ~/.config/i3/wallpaper.jpg exec_always --no-startup-id feh --bg-scale ~/.config/i3/wallpaper.jpg
### Run status bar ### Run status bar
exec_always ~/.config/polybar/launch.sh exec_always --no-startup-id ~/.config/polybar/launch.sh
### Run in background X11 compositor ### Run in background X11 compositor
exec_always picom --config ~/.config/picom/picom.conf exec_always --no-startup-id picom --config ~/.config/picom/picom.conf
### Run in background notification daemon ### Run in background notification daemon
exec_always $notification exec_always --no-startup-id $notification
exec --no-startup-id $clipboard
### Enable autolock ### Enable autolock
exec_always xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep exec_always xautolock -time 5 -locker ~/.config/i3/scripts/lockscreen.sh -detectsleep
@@ -334,3 +342,6 @@ exec flameshot
### Run my preferred editor ### Run my preferred editor
exec $editor exec $editor
### Run my preferred browser
exec flatpak run $browser

View File

@@ -1,13 +1,12 @@
#!/bin/bash #!/bin/bash
# Menu di power con rofi chosen=$(echo -e "⏻ Shutdown\n Restart\n Logout\n Suspend\n Hibernate" | rofi -dmenu -p "Power Menu:" -theme-str 'window {width: 20%;}')
chosen=$(echo -e "⏻ Spegni\n Riavvia\n Logout\n Sospendi\n Iberna" | rofi -dmenu -p "Power Menu:" -theme-str 'window {width: 20%;}')
case "$chosen" in case "$chosen" in
"⏻ Spegni") systemctl poweroff ;; "⏻ Shutdown") systemctl poweroff ;;
" Riavvia") systemctl reboot ;; " Restart") systemctl reboot ;;
" Logout") loginctl terminate-session $XDG_SESSION_ID ;; " Logout") loginctl terminate-session $XDG_SESSION_ID ;;
" Sospendi") systemctl suspend ;; " Suspend") systemctl suspend ;;
" Iberna") systemctl hibernate ;; " Hibernate") systemctl hibernate ;;
*) exit 0 ;; *) exit 0 ;;
esac esac

View File

@@ -121,7 +121,7 @@ font-0 = "JetBrainsMono Nerd Font:size=12;2"
; modules-right = ipc clock ; modules-right = ipc clock
modules-left = xworkspaces modules-left = xworkspaces
modules-center = modules-center =
modules-right = spotify filesystem memory cpu pulseaudio backlight battery xkeyboard date systray modules-right = spotify filesystem memory cpu pulseaudio backlight battery0 battery1 xkeyboard date systray
; Value to be used to set the WM_NAME atom ; Value to be used to set the WM_NAME atom
; If the value is empty or undefined, the atom value ; If the value is empty or undefined, the atom value

View File

@@ -66,7 +66,7 @@ type = internal/memory
interval = 2 interval = 2
format-prefix = " " format-prefix = " "
format-prefix-foreground = ${colors.teal} format-prefix-foreground = ${colors.teal}
label = %percentage_used:2%% label = %gb_used%/%gb_total%
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
@@ -100,7 +100,7 @@ date-alt = %Y-%m-%d %H:%M:%S
label = %date% label = %date%
;label-foreground = ${colors.blue} ;label-foreground = ${colors.blue}
[module/battery] [module/battery0]
type = internal/battery type = internal/battery
; This is useful in case the battery never reports 100% charge ; This is useful in case the battery never reports 100% charge
@@ -191,7 +191,135 @@ format-low-foreground = ${colors.red}
; %percentage_raw% ; %percentage_raw%
; %time% ; %time%
; %consumption% (shows current discharge rate in watts) ; %consumption% (shows current discharge rate in watts)
; New in versinon 3.6.0
; label-low = BATTERY LOW
; Only applies if <ramp-capacity> is used
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
; Only applies if <bar-capacity> is used
bar-capacity-width = 10
; Only applies if <animation-charging> is used
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-4 =
; Framerate in milliseconds
animation-charging-framerate = 750
; Only applies if <animation-discharging> is used
animation-discharging-0 =
animation-discharging-1 =
animation-discharging-2 =
animation-discharging-3 =
animation-discharging-4 =
; Framerate in milliseconds
animation-discharging-framerate = 500
; Only applies if <animation-low> is used
; New in version 3.6.0 ; New in version 3.6.0
;animation-low-0 = !
;animation-low-1 =
;animation-low-framerate = 200
[module/battery1]
type = internal/battery
; This is useful in case the battery never reports 100% charge
; Default: 100
full-at = 100
; format-low once this charge percentage is reached
; Default: 10
; New in version 3.6.0
low-at = 20
; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/
battery = BAT1
adapter = ADP1
; If an inotify event haven't been reported in this many
; seconds, manually poll for new values.
;
; Needed as a fallback for systems that don't report events
; on sysfs/procfs.
;
; Disable polling by setting the interval to 0.
;
; Default: 5
poll-interval = 5
; see "man date" for details on how to format the time string
; NOTE: if you want to use syntax tags here you need to use %%{...}
; Default: %H:%M:%S
time-format = %H:%M
; Available tags:
; <label-charging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-charging>
format-charging = <animation-charging> <label-charging>
animation-charging-foreground = ${colors.green}
; Available tags:
; <label-discharging> (default)
; <bar-capacity>
; <ramp-capacity>
; <animation-discharging>
format-discharging = <ramp-capacity> <label-discharging>
ramp-capacity-foreground = ${colors.yellow}
; Available tags:
; <label-full> (default)
; <bar-capacity>
; <ramp-capacity>
format-full = <ramp-capacity> <label-full>
format-full-foreground = ${colors.green}
; Format used when battery level drops to low-at
; If not defined, format-discharging is used instead.
; Available tags:
; <label-low>
; <animation-low>
; <bar-capacity>
; <ramp-capacity>
; New in version 3.6.0
format-low = <ramp-capacity> <label-low>
format-low-foreground = ${colors.red}
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
; %time%
; %consumption% (shows current charge rate in watts)
;label-charging = Charging %percentage%%
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
; %time%
; %consumption% (shows current discharge rate in watts)
;label-discharging = Discharging %percentage%%
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
;label-full = Fully charged
; Available tokens:
; %percentage% (default) - is set to 100 if full-at is reached
; %percentage_raw%
; %time%
; %consumption% (shows current discharge rate in watts)
; New in versinon 3.6.0
; label-low = BATTERY LOW ; label-low = BATTERY LOW
; Only applies if <ramp-capacity> is used ; Only applies if <ramp-capacity> is used

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Paths to battery capacity files
battery0_capacity="/sys/class/power_supply/BAT0/capacity"
battery1_capacity="/sys/class/power_supply/BAT1/capacity"
# Check if the capacity files exist
if [[ -f "$battery0_capacity" && -f "$battery1_capacity" ]]; then
# Read the battery percentages
battery0_charge=$(cat "$battery0_capacity")
battery1_charge=$(cat "$battery1_capacity")
# Calculate the average charge
average_charge=$(( (battery0_charge + battery1_charge) / 2 ))
# Print the average percentage
echo "$average_charge%"
else
# If one of the files is missing, print an error
echo "Error: one or more battery capacity files not found."
fi