Skip to content

Instantly share code, notes, and snippets.

@nilskoppelmann
Created January 13, 2015 19:45
Show Gist options
  • Save nilskoppelmann/e7ed21e84a5d671d96e3 to your computer and use it in GitHub Desktop.
Save nilskoppelmann/e7ed21e84a5d671d96e3 to your computer and use it in GitHub Desktop.
Gnome Button Window Buttons Arrangement --- tested with Debian
#!/bin/bash
echo "Layouts:"
echo "1) x - +"
echo "2) x + -"
echo "3) - x +"
echo "4) - + x"
echo "5) + - x"
echo "6) + x -"
## asking for choice
read -p "Which layout do you want? " "entry"
echo "Which side do you want the buttons to appear?"
read -p "[L]eft or [R]ight] " "direction"
## defining components
x="close"
min="minimize"
max="maximize"
dir=":"
## evaluating the results
## layout
if [ $entry -eq 1 ]
then
buttons=$x","$min","$max
elif [ $entry -eq 2 ]
then
buttons=$x","$max","$min
elif [ $entry -eq 3 ]
then
buttons=$min","$x","$max
elif [ $entry -eq 4 ]
then
buttons=$min","$max","$x
elif [ $entry -eq 5 ]
then
buttons=$max","$min","$x
elif [ $entry -eq 6 ]
then
buttons=$max","$x","$min
fi
## appearance of button-group
if [ $direction = "L" ]
then
output=$buttons$dir
elif [ $direction = "R" ]
then
output=$dir$buttons
else
## if $direction != valid -> ask again
## -!> not possible due to requestioning
echo "Which side do you want the buttons to appear?"
read -p "[L]eft or [R]ight] " "direction"
fi
## display $output
# echo $output
## set new value for key "button-layout" in "org.gnome.shell.overrides"
dconf write /org/gnome/shell/overrides/button-layout '"'$output'"'
echo "Buttons have been repostioned."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment