dotfiles/stow_home/spectrwm/.config/spectrwm/scripts
joelchrono12 85d78e3b5e
organized everything so stow does not get confused with readme files
2021-08-29 09:56:00 -05:00
..
README.org organized everything so stow does not get confused with readme files 2021-08-29 09:56:00 -05:00
keep-trayer-ws.sh organized everything so stow does not get confused with readme files 2021-08-29 09:56:00 -05:00
volume-spectrwm.sh organized everything so stow does not get confused with readme files 2021-08-29 09:56:00 -05:00
workspace-windows.sh organized everything so stow does not get confused with readme files 2021-08-29 09:56:00 -05:00

README.org

Other useful Spectrwm scripts

My spectrwm scripts

These are other kinds of scripts that you can use alongside my main baraction.sh script. They make use of wmctrl to add some level of functionality to Spectrwm. Here are the scripts! Once generated, make sure to do the following command to make them executable!

chmod +x file.sh

Keep trayer on workspace

This script makes sure that trayer or any system tray or application stays in your current workspace. Spectrwm does not work very well with these kinda programs, and this solution is still kinda hacky, which is why its not part of my main script. If it does not work, sorry.

#!/bin/bash
current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
wmctrl -r panel -t $current_ws

Number of windows in workspace

A simple script that shows how many windows are open inside of current workspace

#!/bin/bash
ws_icon="$(wmctrl -d | grep "*" | awk '{print $9}')"
windows_number="$(wmctrl -l | grep -v panel | awk '{print $2}'))"
current_ws="$(wmctrl -d | grep '*' | awk '{print $1}')"
windows_in_ws="$(echo -e "$windows_number" | grep $current_ws | wc -l)"
echo -e "[$ws_icon ] [$windows_in_ws]"

Volume control

I normally use the volumeicon to take care of this, or pamixer on a terminal, but this script can do it too!, kinda… Make sure to add this line to beginning or the main bar script

trap 'update' 5

And this is the script itself.

#!/bin/bash
volumecontrol() {
    pkill -SIGTRAP baraction.sh
    case $1 in
        increase)
            amixer set Master 5%+
            ;;
        ecrease)
            amixer set Master 5%-
            ;;
        toggle)
            amixer set Master toggle
            ;;
        ,*)
            ;;
    esac;
}

volumecontrol $1