Replace common functionality with rust implementation

This commit is contained in:
2025-09-03 17:06:13 +02:00
parent d0d162f3e9
commit d31d39473b
38 changed files with 2871 additions and 204 deletions

View File

@@ -209,18 +209,13 @@ assign [class="^Wine$"] $workspace10
bindsym $mod+Return exec $terminal
bindsym $mod+Shift+Return exec $calc
bindsym F1 exec --no-startup-id $scriptdir/shutdown-menu
bindsym F2 exec --no-startup-id $scriptdir/screenmenu
bindsym F1 exec --no-startup-id workstation-client power menu
bindsym $mod+F1 exec --no-startup-id $scriptdir/i3exit lock
bindsym $mod+F4 exec --no-startup-id $scriptdir/i3exit suspend
bindsym $mod+Home exec --no-startup-id $scriptdir/shutdown-menu
bindsym $mod+F1 exec --no-startup-id workstation-client power lock
bindsym $mod+$screenshot exec --no-startup-id sh -c 'maim | xclip -selection clipboard -t image/png'
bindsym $mod+Shift+$screenshot exec --no-startup-id sh -c 'maim --select | xclip -selection clipboard -t image/png'
bindsym $mod+Shift+v exec --no-startup-id redshift-toggle
bindsym $mod+$pim_toggle exec --no-startup-id $scriptdir/swap-from-workspace $workspace10
################################################################################
@@ -313,22 +308,22 @@ bindsym $mod+F9 exec --no-startup-id evolution
### SPECIAL KEYBINDS ###########################################################
################################################################################
bindsym XF86Sleep exec --no-startup-id $scriptdir/i3exit suspend
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute '@DEFAULT_SINK@' toggle
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume '@DEFAULT_SINK@' +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume '@DEFAULT_SINK@' -5%
bindsym XF86Sleep exec --no-startup-id workstation-client power lock
bindsym XF86AudioPlay exec --no-startup-id playerctl -p spotify play-pause
bindsym XF86AudioNext exec --no-startup-id playerctl -p spotify next
bindsym XF86AudioPrev exec --no-startup-id playerctl -p spotify previous
bindsym XF86AudioMute exec --no-startup-id workstation-client pulseaudio output toggle
bindsym XF86AudioRaiseVolume exec --no-startup-id workstation-client pulseaudio output inc
bindsym XF86AudioLowerVolume exec --no-startup-id workstation-client pulseaudio output dec
# keys seemingly switched
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set 8%+ ; exec --no-startup-id $scriptdir/update-status
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 8%- ; exec --no-startup-id $scriptdir/update-status
bindsym XF86AudioPlay exec --no-startup-id workstation-client spotify toggle
bindsym XF86AudioNext exec --no-startup-id workstation-client spotify next
bindsym XF86AudioPrev exec --no-startup-id workstation-client spotify previous
bindsym $mod+m exec --no-startup-id pactl set-source-mute '@DEFAULT_SOURCE@' toggle
bindsym $mod+space exec --no-startup-id pactl set-source-mute '@DEFAULT_SOURCE@' toggle
bindsym KP_Enter exec --no-startup-id pactl set-source-mute '@DEFAULT_SOURCE@' toggle
bindsym XF86MonBrightnessUp exec --no-startup-id workstation-client brightness inc
bindsym XF86MonBrightnessDown exec --no-startup-id workstation-client brightness dec
bindsym $mod+m exec --no-startup-id workstation-client pulseaudio input toggle
bindsym $mod+space exec --no-startup-id workstation-client pulseaudio input toggle
bindsym KP_Enter exec --no-startup-id workstation-client pulseaudio input toggle
##############################################################################
### BARS #######################################################################

View File

@@ -33,7 +33,7 @@ format = " $icon{ $volume.eng(w:2)|} "
[[block.click]]
button = "left"
cmd = "pactl set-sink-mute '@DEFAULT_SINK@' toggle"
cmd = "workstation-client pulseaudio output toggle"
update = true
[[block]]
@@ -50,7 +50,7 @@ idle_bg = { link = "warning_bg" }
[[block.click]]
button = "left"
cmd = "pactl set-source-mute '@DEFAULT_SOURCE@' toggle"
cmd = "workstation-client pulseaudio input toggle"
update = true
[[block]]
@@ -67,31 +67,32 @@ missing_format = ""
[[block]]
block = "toggle"
format = "  $icon "
command_on = "$XDG_CONFIG_HOME/i3/scripts/presentation-mode toggle ; pkill -SIGRTMIN+0 i3status-rs"
command_off = "$XDG_CONFIG_HOME/i3/scripts/presentation-mode toggle ; pkill -SIGRTMIN+0 i3status-rs"
command_state = "[[ $($XDG_CONFIG_HOME/i3/scripts/presentation-mode status) == on ]] && echo active"
signal = 1
command_on = "workstation-client present toggle ; pkill -SIGRTMIN+1 i3status-rs"
command_off = "workstation-client present toggle ; pkill -SIGRTMIN+1 i3status-rs"
command_state = "[[ $(workstation-client present status) == on ]] && echo active"
[[block]]
block = "toggle"
format = "  $icon "
command_on = "systemctl --user start color-theme-light"
command_off = "systemctl --user start color-theme-dark"
command_state = "[[ $(systemctl --user is-active color-theme-light) == active ]] && echo active"
command_on = "workstation-client theme light"
command_off = "workstation-client theme dark"
command_state = "[[ $(workstation-client theme status) == light ]] && echo 1"
[[block]]
block = "toggle"
format = "  $icon "
command_on = "systemctl --user start redshift"
command_off = "systemctl --user stop redshift"
command_state = "[[ $(systemctl --user is-active redshift) == active ]] && echo active"
command_on = "workstation-client redshift start"
command_off = "workstation-client redshift stop"
command_state = "[[ $(workstation-client redshift status) == active ]] && echo 1"
signal = 0
[[block]]
block = "toggle"
format = "  $icon "
command_on = "systemctl --user start spotify"
command_off = "systemctl --user stop spotify"
command_state = "[[ $(systemctl --user is-active spotify) == active ]] && echo active"
command_on = "workstation-client spotify start"
command_off = "workstation-client spotify stop"
command_state = "[[ $(workstation-client spotify status) == active ]] && echo 1"
signal = 0
[[block]]
@@ -101,8 +102,9 @@ command = "ping -n -q -w 2 -c 1 8.8.8.8 >/dev/null 2>/dev/null && printf '{\"tex
[[block]]
block = "custom"
command = "curl -s 'https://wttr.in/Ansbach?m&T&format=%c%t' | sed 's/ / /g'"
interval = 3600
command = "workstation-client weather get"
# caching is handled by the workstation daemon
interval = 60
[[block]]
block = "time"

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
rofi -show combi -combi-modi run -display-combi "run"

View File

@@ -1,84 +0,0 @@
#!/bin/bash
### From http://www.archlinux.org/index.php/i3
_logfile="$XDG_RUNTIME_DIR/i3exit.log"
touch "$_logfile"
log()
{
echo "$*"
echo "[$(date +%FT%T)] $*" >> "$_logfile"
}
lock()
{
set -x
playerctl -p spotify pause
i3lock --nofork --show-failed-attempts --ignore-empty-password \
--color "000000"
}
screen_off() {
xset dpms force off
}
reset_screen() {
systemctl --user restart dpms.service
}
lock_and_screen_off() {
lock &
_pid=$!
dunst_paused=$(dunstctl is-paused)
[[ "${dunst_paused}" != "true" ]] && dunstctl set-paused true
screen_off
wait $_pid
[[ "${dunst_paused}" != "true" ]] && dunstctl set-paused false
reset_screen
}
signal="$1"
log "[I] Received signal \"$signal\"."
case "$signal" in
lock)
log "[I] Locking session."
lock_and_screen_off
;;
logout)
log "[I] Exiting i3."
i3-msg exit
;;
suspend)
log "[I] Suspending."
lock &
sleep 0.1
systemctl suspend
;;
hibernate)
log "[I] Hibernating."
sudo systemctl hibernate
;;
reboot)
log "[I] Rebooting."
systemctl reboot
;;
shutdown)
log "[I] Shutting down."
systemctl poweroff
;;
screen-off)
log "[I] Turning screen off."
screen_off
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
log "[E] Signal \"$signal\" unknown. Aborting."
exit 2
esac
log "[I] Done."
exit 0

View File

@@ -1,47 +0,0 @@
#!/usr/bin/env bash
_status_file="${XDG_RUNTIME_DIR}/presentation-mode-on"
is_on() {
[[ -e "${_status_file}" ]]
}
switch_on() {
touch "${_status_file}"
dunstctl set-paused true &
systemctl --user --no-block stop redshift.service
systemctl --user --no-block stop spotify.service
}
switch_off() {
rm -f "${_status_file}"
dunstctl set-paused false &
systemctl --user --no-block start redshift.service
systemctl --user --no-block start spotify.service
}
case "$1" in
status)
if is_on ; then
printf "on\n"
else
printf "off\n"
fi
;;
toggle)
if is_on ; then
switch_off
else
switch_on
fi
;;
off)
switch_off
;;
on)
switch_on
;;
esac

View File

@@ -1,19 +0,0 @@
#!/usr/bin/env bash
options=(
"lock"
"logout"
"suspend"
"hibernate"
"reboot"
"shutdown"
"screen-off")
i=1
output=$(
for option in "${options[@]}"; do
echo "($i) $option"
(( i++ ))
done | rofi -dmenu -p "action" -no-custom)
[[ "$output" ]] && "$(dirname "$0")"/i3exit "${output#(*) }"