11#! /bin/bash
22
33# check current status
4+ # action=$1
45if [ " $1 " == " check" ]; then
56 # for KDE Plasma only
67 if [[ " $XDG_CURRENT_DESKTOP " == * " KDE" * ]] || [[ " $XDG_CURRENT_DESKTOP " == * " Plasma" * ]]; then
@@ -33,12 +34,13 @@ if [ "$1" == "check" ]; then
3334 fi
3435
3536# change the state
37+ # action=$1
38+ # state=$2
3639elif [ " $1 " == " toggle" ]; then
37- state=" $2 "
3840 # for KDE Plasma only
3941 if [[ " $XDG_CURRENT_DESKTOP " == * " KDE" * ]] || [[ " $XDG_CURRENT_DESKTOP " == * " Plasma" * ]]; then
4042 # if the state is true
41- if [ " $state " == " true" ]; then
43+ if [ " $2 " == " true" ]; then
4244 # execute a command as a user
4345 any command as user
4446 # execute a command as root, prompting for a password only once.
@@ -55,7 +57,7 @@ elif [ "$1" == "toggle" ]; then
5557 # for GNOME ONly
5658 elif [[ " $XDG_CURRENT_DESKTOP " == * " GNOME" * ]]; then
5759 # if the state is true
58- if [ " $state " == " true" ]; then
60+ if [ " $2 " == " true" ]; then
5961 # execute a command as a user
6062 any command as user
6163 # execute a command as root, prompting for a password only once.
@@ -72,7 +74,7 @@ elif [ "$1" == "toggle" ]; then
7274 # for XFCE only
7375 elif [ -n " $( grep SHMC $HOME /.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml) " ]; then
7476 # if the state is true
75- if [ " $state " == " true" ]; then
77+ if [ " $2 " == " true" ]; then
7678 # execute a command as a user
7779 any command as user
7880 # execute a command as root, prompting for a password only once.
@@ -89,7 +91,7 @@ elif [ "$1" == "toggle" ]; then
8991 # for CINNAMON only
9092 elif [[ " $XDG_CURRENT_DESKTOP " == * " Cinnamon" * ]] || [[ " $XDG_CURRENT_DESKTOP " == * " X-Cinnamon" * ]]; then
9193 # if the state is true
92- if [ " $state " == " true" ]; then
94+ if [ " $2 " == " true" ]; then
9395 # execute a command as a user
9496 any command as user
9597 # execute a command as root, prompting for a password only once.
0 commit comments