deskgrid cfg file update
parent
90f4e264e8
commit
e84af0d5db
5
bin/chwp
5
bin/chwp
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONFIG_DIR="$HOME/.config/chwp"
|
CONFIG_DIR="$HOME/.config/chwp"
|
||||||
CONFIG_FILE="$CONFIG_DIR/chwp.conf"
|
CONFIG_FILE="$CONFIG_DIR/chwp.conf"
|
||||||
WALLPAPERS_LIST="$CONFIG_DIR/wplist"
|
WALLPAPERS_LIST="$CONFIG_DIR/wplist"
|
||||||
|
@ -12,7 +13,7 @@ cat <<EOF > ${CONFIG_FILE}
|
||||||
# Directory with wallpapers
|
# Directory with wallpapers
|
||||||
wallpaper_dir=/usr/share/backgrounds/
|
wallpaper_dir=/usr/share/backgrounds/
|
||||||
# Rotate time in seconds
|
# Rotate time in seconds
|
||||||
interval=10
|
interval=60
|
||||||
# Wallpaper setter program: nitrogen or feh
|
# Wallpaper setter program: nitrogen or feh
|
||||||
setter=nitrogen
|
setter=nitrogen
|
||||||
EOF
|
EOF
|
||||||
|
@ -23,7 +24,7 @@ source <(grep = $CONFIG_FILE)
|
||||||
|
|
||||||
# decide which setter and command use to set wallpaper
|
# decide which setter and command use to set wallpaper
|
||||||
case "$setter" in
|
case "$setter" in
|
||||||
nitrogen) command="nitrogen --set-zoom-fill";;
|
nitrogen) command="nitrogen --set-zoom-fill --save";;
|
||||||
feh) command="feh --bg-fill" ;;
|
feh) command="feh --bg-fill" ;;
|
||||||
*) echo "Unknown wallpaper setter. Please check your config file $CONFIG_FILE";exit 1;;
|
*) echo "Unknown wallpaper setter. Please check your config file $CONFIG_FILE";exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
28
bin/deskgrid
28
bin/deskgrid
|
@ -7,16 +7,16 @@
|
||||||
|
|
||||||
|
|
||||||
CONFIG_DIR=~/.config/deskgrid
|
CONFIG_DIR=~/.config/deskgrid
|
||||||
CONFIG_FILE="$CONFIG_DIR/deskgrid.conf"
|
CONFIG_FILE="$CONFIG_DIR/deskgrid.cfg"
|
||||||
mkdir -p $CONFIG_DIR
|
mkdir -p $CONFIG_DIR
|
||||||
if [ ! -f $CONFIG_FILE ]; then
|
if [ ! -f $CONFIG_FILE ]; then
|
||||||
cat <<EOF > ${CONFIG_FILE}
|
cat <<EOF > ${CONFIG_FILE}
|
||||||
# Gap between windows in pixels (reasonable values: 0 8 16 24)
|
# Gap between windows in pixels (reasonable values: 0 8 16 24)
|
||||||
gap=16
|
gap=16
|
||||||
# Grid columns (12 16 24)
|
# Grid columns (12 16 24)
|
||||||
grid_x=16
|
columns=12
|
||||||
# Grid rows (6 12 16)
|
# Grid rows (6 12 16)
|
||||||
grid_y=12
|
rows=6
|
||||||
#
|
#
|
||||||
titlebar_height=18
|
titlebar_height=18
|
||||||
#Notifications true or false
|
#Notifications true or false
|
||||||
|
@ -30,8 +30,8 @@ fi
|
||||||
source <(grep = $CONFIG_FILE)
|
source <(grep = $CONFIG_FILE)
|
||||||
|
|
||||||
GAP=${gap:-16}
|
GAP=${gap:-16}
|
||||||
GRID_X=${grid_x:-12}
|
COLUMNS=${columns:-12}
|
||||||
GRID_Y=${grid_y:-6}
|
ROWS=${rows:-6}
|
||||||
TITLEBAR_HEIGHT=${titlebar_height:-18}
|
TITLEBAR_HEIGHT=${titlebar_height:-18}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ fi
|
||||||
slop=$(slop --highlight -b 4 --tolerance=0 --color=0.3,0.4,0.6,0.4 -f "%x %y %w %h") || exit 1
|
slop=$(slop --highlight -b 4 --tolerance=0 --color=0.3,0.4,0.6,0.4 -f "%x %y %w %h") || exit 1
|
||||||
read -r X Y W H < <(echo $slop)
|
read -r X Y W H < <(echo $slop)
|
||||||
|
|
||||||
start_x="$(((X-MARGIN_X)/(AVAIL_X/GRID_X)))"
|
start_x="$(((X-MARGIN_X)/(AVAIL_X/COLUMNS)))"
|
||||||
start_y="$(((Y-MARGIN_Y)/(AVAIL_Y/GRID_Y)))"
|
start_y="$(((Y-MARGIN_Y)/(AVAIL_Y/ROWS)))"
|
||||||
end_x="$(((X-MARGIN_X+W)/(AVAIL_X/GRID_X)))"
|
end_x="$(((X-MARGIN_X+W)/(AVAIL_X/COLUMNS)))"
|
||||||
end_y="$(((Y-MARGIN_Y+H)/(AVAIL_Y/GRID_Y)))"
|
end_y="$(((Y-MARGIN_Y+H)/(AVAIL_Y/ROWS)))"
|
||||||
|
|
||||||
### Outer gap factor
|
### Outer gap factor
|
||||||
if [[ $show_outer_gap = true ]]; then GF="1" ; else GF="0" ; fi
|
if [[ $show_outer_gap = true ]]; then GF="1" ; else GF="0" ; fi
|
||||||
|
@ -80,12 +80,12 @@ if [[ $show_outer_gap = true ]]; then GF="1" ; else GF="0" ; fi
|
||||||
if [[ $start_x = "0" ]]; then GAP_X="$((GAP*GF))" ; else GAP_X=$((GAP/2)) ; fi
|
if [[ $start_x = "0" ]]; then GAP_X="$((GAP*GF))" ; else GAP_X=$((GAP/2)) ; fi
|
||||||
if [[ $start_y = "0" ]]; then GAP_Y="$((GAP*GF))" ; else GAP_Y=$((GAP/2)) ; fi
|
if [[ $start_y = "0" ]]; then GAP_Y="$((GAP*GF))" ; else GAP_Y=$((GAP/2)) ; fi
|
||||||
|
|
||||||
if [[ $end_x = $((GRID_X-1)) ]]; then GAP_X_END="$((GAP*GF))" ; else GAP_X_END=$((GAP/2)) ; fi
|
if [[ $end_x = $((COLUMNS-1)) ]]; then GAP_X_END="$((GAP*GF))" ; else GAP_X_END=$((GAP/2)) ; fi
|
||||||
if [[ $end_y = $((GRID_Y-1)) ]]; then GAP_Y_END="$((GAP*GF))" ; else GAP_Y_END=$((GAP/2)) ; fi
|
if [[ $end_y = $((ROWS-1)) ]]; then GAP_Y_END="$((GAP*GF))" ; else GAP_Y_END=$((GAP/2)) ; fi
|
||||||
|
|
||||||
SIZE="$(((end_x-start_x+1)*(AVAIL_X/GRID_X)-GAP_X-GAP_X_END)) $(((end_y-start_y+1)*(AVAIL_Y/GRID_Y)-GAP_Y-GAP_Y_END-T))"
|
SIZE="$(((end_x-start_x+1)*(AVAIL_X/COLUMNS)-GAP_X-GAP_X_END)) $(((end_y-start_y+1)*(AVAIL_Y/ROWS)-GAP_Y-GAP_Y_END-T))"
|
||||||
|
|
||||||
POSITION="$((start_x*AVAIL_X/GRID_X+GAP_X+MARGIN_X)) $((start_y*AVAIL_Y/GRID_Y+GAP_Y+MARGIN_Y))"
|
POSITION="$((start_x*AVAIL_X/COLUMNS+GAP_X+MARGIN_X)) $((start_y*AVAIL_Y/ROWS+GAP_Y+MARGIN_Y))"
|
||||||
|
|
||||||
xdotool windowsize $WINDOW $SIZE
|
xdotool windowsize $WINDOW $SIZE
|
||||||
|
|
||||||
|
@ -95,5 +95,5 @@ xdotool windowmap $WINDOW
|
||||||
|
|
||||||
if [ $notifications = true ]; then
|
if [ $notifications = true ]; then
|
||||||
notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Info" "You can disable those notifications or edit config file using buttons below.\n\n" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit DeskGrid config file:geany ~/.config/deskgrid/deskgrid.conf"
|
notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Info" "You can disable those notifications or edit config file using buttons below.\n\n" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit DeskGrid config file:geany ~/.config/deskgrid/deskgrid.conf"
|
||||||
#notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Success notification" "You can disable those notifications by editing config file. Button below.\nScreensize: $SCREENSIZE\nMargins: $MARGINS\nAvailable size: $AVAILSIZE\nGrid: $((AVAIL_X/GRID_X)) x $((AVAIL_Y/GRID_Y)) Selection: $slop\nPosition: <b>$POSITION</b>\n($start_x*$AVAIL_X/$GRID_X+$GAP_X+$MARGIN_X)\n($start_y*$AVAIL_Y/$GRID_Y+$GAP_Y+$MARGIN_Y) \nSize: $SIZE" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit config file:geany ~/.config/deskgrid/deskgrid.conf"
|
#notify-send.sh -t 15000 --replace-file=/tmp/deskgrid --icon=mbcc "Success notification" "You can disable those notifications by editing config file. Button below.\nScreensize: $SCREENSIZE\nMargins: $MARGINS\nAvailable size: $AVAILSIZE\nGrid: $((AVAIL_X/COLUMNS)) x $((AVAIL_Y/ROWS)) Selection: $slop\nPosition: <b>$POSITION</b>\n($start_x*$AVAIL_X/$COLUMNS+$GAP_X+$MARGIN_X)\n($start_y*$AVAIL_Y/$ROWS+$GAP_Y+$MARGIN_Y) \nSize: $SIZE" -o "Disable notifications:mb-setvar enable_notifications=false ~/.config/deskgrid/deskgrid.conf" -o "Edit config file:geany ~/.config/deskgrid/deskgrid.conf"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -55,6 +55,7 @@ savesession() {
|
||||||
sd -s "/usr/lib/chromium/chromium" "chromium --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "/usr/lib/chromium/chromium" "chromium --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sd -s "/usr/lib/firefox/firefox" "firefox --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "/usr/lib/firefox/firefox" "firefox --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sd -s "/usr/bin/python3 /usr/bin/terminator" "terminator" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "/usr/bin/python3 /usr/bin/terminator" "terminator" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
|
sd -s "/usr/bin/python /usr/bin/terminator" "terminator" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sd -s "geany" "geany -i" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "geany" "geany -i" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sd -s "cherrytree" "cherrytree --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "cherrytree" "cherrytree --new-window" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sd -s "pcmanfm -d" "pcmanfm -n" "$SESSIONDIR/${filename// /_}.desk"
|
sd -s "pcmanfm -d" "pcmanfm -n" "$SESSIONDIR/${filename// /_}.desk"
|
||||||
|
@ -63,6 +64,7 @@ savesession() {
|
||||||
sed -i '/usr/lib/chromium/chromium,chromium --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i '/usr/lib/chromium/chromium,chromium --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sed -i '/usr/lib/firefox/firefox,firefox --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i '/usr/lib/firefox/firefox,firefox --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sed -i '/usr/bin/python3 /usr/bin/terminator,terminator,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i '/usr/bin/python3 /usr/bin/terminator,terminator,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
|
sed -i '/usr/bin/python /usr/bin/terminator,terminator,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sed -i 'geany,geany -i,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i 'geany,geany -i,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sed -i 'cherrytree,cherrytree --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i 'cherrytree,cherrytree --new-window,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
sed -i 'pcmanfm -d,pcmanfm -n,' "$SESSIONDIR/${filename// /_}.desk"
|
sed -i 'pcmanfm -d,pcmanfm -n,' "$SESSIONDIR/${filename// /_}.desk"
|
||||||
|
|
35
bin/drawgrid
35
bin/drawgrid
|
@ -1,31 +1,50 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CONFIG_DIR="$HOME/.config/deskgrid"
|
CONFIG_DIR="$HOME/.config/deskgrid"
|
||||||
CONFIG_FILE="$CONFIG_DIR/deskgrid.conf"
|
CONFIG_FILE="$CONFIG_DIR/deskgrid.cfg"
|
||||||
|
mkdir -p $CONFIG_DIR
|
||||||
|
if [ ! -f $CONFIG_FILE ]; then
|
||||||
|
cat <<EOF > ${CONFIG_FILE}
|
||||||
|
# Gap between windows in pixels (reasonable values: 0 8 16 24)
|
||||||
|
gap=16
|
||||||
|
# Grid columns (12 16 24)
|
||||||
|
columns=12
|
||||||
|
# Grid rows (6 12 16)
|
||||||
|
rows=6
|
||||||
|
#
|
||||||
|
titlebar_height=18
|
||||||
|
#Notifications true or false
|
||||||
|
notifications=true
|
||||||
|
# Outer gap (disable if you use WM margins)
|
||||||
|
show_outer_gap=true
|
||||||
|
# Only for clicksnap action
|
||||||
|
activate_window=false
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
source <(grep = $CONFIG_FILE)
|
source <(grep = $CONFIG_FILE)
|
||||||
|
|
||||||
GAP=${gap:-16}
|
GAP=${gap:-16}
|
||||||
GRID_X=${grid_x:-12}
|
COLUMNS=${columns:-12}
|
||||||
GRID_Y=${grid_y:-6}
|
ROWS=${rows:-6}
|
||||||
|
|
||||||
AVAILSIZE=$(wmctrl -d |grep "*"|awk -F' ' '{print $9}')
|
AVAILSIZE=$(wmctrl -d |grep "*"|awk -F' ' '{print $9}')
|
||||||
AVAIL_X="${AVAILSIZE%x*}"
|
AVAIL_X="${AVAILSIZE%x*}"
|
||||||
AVAIL_Y="${AVAILSIZE#*x}"
|
AVAIL_Y="${AVAILSIZE#*x}"
|
||||||
|
|
||||||
TILE_WIDTH="$((AVAIL_X/GRID_X))"
|
TILE_WIDTH="$((AVAIL_X/COLUMNS))"
|
||||||
TILE_HEIGHT="$((AVAIL_Y/GRID_Y))"
|
TILE_HEIGHT="$((AVAIL_Y/ROWS))"
|
||||||
|
|
||||||
rectangles=""
|
rectangles=""
|
||||||
row="0"
|
row="0"
|
||||||
for row in $(seq 0 $((GRID_Y-1)));
|
for row in $(seq 0 $((ROWS-1)));
|
||||||
do
|
do
|
||||||
for tile in $(seq 0 $((GRID_X-1)));
|
for tile in $(seq 0 $((COLUMNS-1)));
|
||||||
do
|
do
|
||||||
rectangles+="rectangle $((tile*TILE_WIDTH)),$((row*TILE_HEIGHT)) $((tile*TILE_WIDTH+TILE_WIDTH)),$((row*TILE_HEIGHT+TILE_HEIGHT)) ";
|
rectangles+="rectangle $((tile*TILE_WIDTH)),$((row*TILE_HEIGHT)) $((tile*TILE_WIDTH+TILE_WIDTH)),$((row*TILE_HEIGHT+TILE_HEIGHT)) ";
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
name="text 24,96 DeskGrid"
|
name="text 24,96 DeskGrid"
|
||||||
text="text 30,120 \"Hello I'm here to help you get familiar with DeskGrid ;)\nGrid: $GRID_X columns, $GRID_Y rows\nSingle tile size: $TILE_WIDTH x $TILE_HEIGHT\n\nUse mousewheel on taskbar to show/hide me\nTo close: middle click on taskbar or click here, then hit q key\""
|
text="text 30,120 \"Hello I'm here to help you get familiar with DeskGrid ;)\nGrid: $COLUMNS columns, $ROWS rows\nSingle tile size: $TILE_WIDTH x $TILE_HEIGHT\n\nUse mousewheel on taskbar to show/hide me\nTo close: middle click on taskbar or click here, then hit q key\""
|
||||||
magick -size $AVAILSIZE xc:LavenderBlush3 -stroke LavenderBlush2 -strokewidth 1 \
|
magick -size $AVAILSIZE xc:LavenderBlush3 -stroke LavenderBlush2 -strokewidth 1 \
|
||||||
-fill LavenderBlush3 \
|
-fill LavenderBlush3 \
|
||||||
-draw "$rectangles" \
|
-draw "$rectangles" \
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
|
|
||||||
_config() {
|
_config() {
|
||||||
CONFIG_DIR="$HOME/.config/deskgrid"
|
CONFIG_DIR="$HOME/.config/deskgrid"
|
||||||
CONFIG_FILE="$CONFIG_DIR/deskgrid.conf"
|
CONFIG_FILE="$CONFIG_DIR/deskgrid.cfg"
|
||||||
mkdir -p $CONFIG_DIR
|
mkdir -p $CONFIG_DIR
|
||||||
if [ ! -f $CONFIG_FILE ]; then
|
if [ ! -f $CONFIG_FILE ]; then
|
||||||
cat <<EOF > ${CONFIG_FILE}
|
cat <<EOF > ${CONFIG_FILE}
|
||||||
# Gap between windows in pixels (reasonable values: 0 8 16 24)
|
# Gap between windows in pixels (reasonable values: 0 8 16 24)
|
||||||
gap=16
|
gap=16
|
||||||
# Grid columns (12 16 24)
|
# Grid columns (12 16 24)
|
||||||
grid_x=16
|
columns=12
|
||||||
# Grid rows (6 12 16)
|
# Grid rows (6 12 16)
|
||||||
grid_y=12
|
rows=6
|
||||||
#
|
#
|
||||||
titlebar_height=18
|
titlebar_height=18
|
||||||
#Notifications true or false
|
#Notifications true or false
|
||||||
|
|
Loading…
Reference in New Issue