From 3370391262fef9f8db72708b2c787490627b9b2d Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Thu, 5 Mar 2020 01:04:46 +0100 Subject: [PATCH] update --- bin/mb-aerosnap | 130 --------------------------- bin/mb-conkypin | 218 ---------------------------------------------- bin/mb-hotcorners | 120 ------------------------- bin/mcc | 2 +- bin/yautostart | 4 +- 5 files changed, 3 insertions(+), 471 deletions(-) delete mode 100755 bin/mb-aerosnap delete mode 100755 bin/mb-conkypin delete mode 100755 bin/mb-hotcorners diff --git a/bin/mb-aerosnap b/bin/mb-aerosnap deleted file mode 100755 index e4dd7c7..0000000 --- a/bin/mb-aerosnap +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python2.7 -# bl-aerosnap: -# A script for adding aero style window snapping to Openbox. -# Repackaged for BunsenLabs by John Crawley. -# Originally written for CrunchBang Linux -# by Philip Newborough -# ---------------------------------------------------------------------- - -from subprocess import Popen, PIPE, STDOUT -import sys, time, os, re - -history = '/tmp/bl-aerosnap-'+str(os.getuid()) -windows = {} -check_intervall = 0.2 - -p = Popen(['xdotool','getdisplaygeometry'], stdout=PIPE, stderr=STDOUT) -Dimensions = p.communicate() -Dimensions = Dimensions[0].replace('\n', '') -Dimensions = Dimensions.split(' ') -width = int(Dimensions[0]) -height = int(Dimensions[1]) -hw = width / 2 -rt = width - 1 -bt = height - 1 -aeroLcommand="wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -e 0,0,0,"+str(hw)+",-1" -aeroRcommand="wmctrl -r :ACTIVE: -b add,maximized_vert && wmctrl -r :ACTIVE: -b remove,maximized_horz && wmctrl -r :ACTIVE: -e 0,"+str(hw)+",0,"+str(hw)+",-1" - - -if os.path.exists(history) == False: - f = open(history,'w') - f.close() - -def print_usage(): - print "bl-aerosnap: usage:" - print " --help show this message and exit" - print " --left attempt to snap active window to left of screen" - print " --right attempt to snap active window to right of screen" - print "" - exit() - -def is_root_window(): - p = Popen(['xdotool', 'getactivewindow'], stdout=PIPE, stderr=STDOUT) - ID = p.communicate() - if len(ID[0]) > 50: - return True - -def window_id(): - p = Popen(['xdotool', 'getactivewindow'], stdout=PIPE) - ID = p.communicate() - ID = int(ID[0]) - p = Popen(['xdotool', 'getwindowpid', str(ID)], stdout=PIPE) - PID = p.communicate() - PID = int(PID[0]) - return str(ID)+'-'+str(PID) - -def window_lookup(): - ID = window_id() - windows = history_load() - if windows.has_key(ID): - return True - -def window_geometry(ID): - ID = ID.split('-') - p = Popen(['xdotool', 'getwindowgeometry', ID[0]], stdout=PIPE) - p = p.communicate() - Pos = re.search(r'\d+,\d+', p[0]) - Size = re.search(r'\d+x\d+', p[0]) - if Pos and Size: - Pos = Pos.group().split(',') - Size = Size.group().split('x') - return Pos[0]+'|'+Pos[1]+'|'+Size[0]+'|'+Size[1] - -def window_store(): - ID = window_id() - windows[ID] = window_geometry(ID) - s = ID +'|'+window_geometry(ID)+'\n' - f = open(history,'a') - f.write(s) - f.close() - -def window_restore(width): - ID = window_id() - G = windows[ID].split('|') - command = 'wmctrl -r :ACTIVE: -b remove,maximized_vert && ' - #FIXME: adjust horizontal placement, not sure where this discrepancy comes from? - AdjustT = int(G[1]) - 40 - command += 'wmctrl -r :ACTIVE: -e 0,'+G[0]+','+str(AdjustT)+','+G[2]+','+G[3] - del windows[ID] - if len(windows) == 0: - o = '' - else: - for key in windows: - h = windows[key].split('|') - o = key+'|'+h[0]+'|'+h[1]+'|'+h[2]+'|'+h[3]+'\n' - f = open(history,'w') - f.write(o) - f.close() - os.system(command) - -def history_load(): - f = open(history,'r') - i = 0 - for line in f: - h = line.split('|') - h[4] = h[4].replace('\n', '') - windows[h[0]] = h[1]+'|'+h[2]+'|'+h[3]+'|'+h[4] - f.close() - return windows - -if len(sys.argv) < 2 or sys.argv[1] == "--help": - print_usage() - -elif sys.argv[1] == "--left": - if is_root_window != True: - if window_lookup(): - window_restore(width) - else: - window_store() - os.system(aeroLcommand) - -elif sys.argv[1] == "--right": - if is_root_window != True: - if window_lookup(): - window_restore(width) - else: - window_store() - os.system(aeroRcommand) - -else: - print_usage() diff --git a/bin/mb-conkypin b/bin/mb-conkypin deleted file mode 100755 index 4581c2d..0000000 --- a/bin/mb-conkypin +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/bash -## -# Script to set the position of a moveable Conky -# -# Written by @damo and @johnraff, November 2015 -# with major contributions by @xaos52 - -DIALOG="yad --center --undecorated --borders=20 \ ---window-icon=distributor-logo-manjaro" - -unset CONKYPATH posX_1 posY_1 posX_2 posY_2 OFFSET_X OFFSET_Y gapX gapY - -case $LANG in - pl*) - EXIT="Wyjście:1" - NOT_SELECTED="Nie wybrano Conky\n\nSpróbować jeszcze raz?" - ALIGNMENT_NONE="To conky ma ustawione 'alignment none',\nwięc pozycja jest ustalana przez Menedżer Okien.\n" - CLICK="Kliknij 'Wybierz Conky' aby wybrać conky.\n\nNastępnie użyj kursora 'xwininfo' na wybranym conky\n" - MOVE="Przesuń Conky w docelowe miejsce\n za pomocą Alt+Lewy klawisz myszy.\n\nKliknij 'OK' aby ustalić nową pozycję." - CHOOSE_CONKY="Wybierz Conky:0" - ;; - *) - EXIT="Exit:1" - NOT_SELECTED="Selection is not a conky\n\nChoose again?" - ALIGNMENT_NONE="This Conky has 'alignment none'\nso placement is handled by the Window Manager.\n" - CLICK="Click 'Select Conky' to pick a conky.\n\nThen use the 'xwininfo' cursor on the chosen conky\nto record its position." - MOVE="Move the Conky to the desired location\nwith Alt+L-mousebutton Drag.\n\nClick 'OK' to set the new position." - CHOOSE_CONKY="Select Conky:0" - ;; -esac - -# makes array "config" -parse_conkyfile(){ - [[ -f $1 ]] || { echo "$1 nie jest plikiem." >&2;return 1;} - unset config - declare -Ag config - local name value - while read name value - do - [[ $name ]] || continue - [[ $name = TEXT* ]] && break - config["$name"]="$value" - done < <(sed 's/\#.*$//' "$1") -} - - -# usage: edit_conkyfile file name=value [name2=value2...] -# use absolute path to file -# parse_conkyfile should already have been run -edit_conkyfile() { - [[ "$1" = /* ]] || { - echo "$0: $1 is not an absolute path." >&2 - return 1 - } - file=$1 - shift - local name value - declare -ag sed_args - while [[ $1 ]]; do - unset name value sed_pattern sed_replace - name="${1%%=*}" - value="${1#*=}" - shift - [[ ${config["$name"]+x} ]] || { - echo "$0: config key $name does not exist" >&2 - return 1 - } - [[ ${config["$name"]//[[:space:]]} = "${value//[[:space:]]}" ]] && continue - (( ${#sed_args[@]} == 0 )) && sed_args=("-ri") - sed_pattern="^ *$name .*$" - grep -q "#conkymove, original value for $name:" "$file" || - sed_replace="#conkymove, original value for $name: ${config[$name]}\n" - sed_replace+="$name $value" - sed_args+=("-e") - sed_args+=("s/$sed_pattern/$sed_replace/") - done - (( ${#sed_args[@]} )) && sed "${sed_args[@]}" "$file" -} - -function getStart(){ # Get initial Conky position - unset CONKYPATH - unset info1 - declare -A info1 - while read line - do - unset key value - [[ $line =~ Window\ id: ]] && { - ID=${line#*id:} - ID=${ID% \"*} - } - [[ $line != xwininfo:* && $line = *:* ]] && { - key=${line%:*} - value=${line#*:} - info1[$key]=$value - } - done < <(xwininfo) - # info now contains all the output of xwininfo - - CMD=$(xprop -id $ID WM_COMMAND | awk -F '", "' '{ - cmd=$1 - sub(/^.*{ "/,"",cmd) - for (i=1;i<=NF;i++) - if($i ~ /-([a-zA-Z])?c/){ - i++ - sub(/\" }$/,"",$i) - gsub(/\\\"/,"\"",$i) - print cmd,$i - exit - } - }' - ) - - if [[ ${CMD%% *} = conky ]];then - echo "Found a conky" - CONKYPATH=${CMD#* } - posX_1=${info1[Absolute upper-left X]} - posY_1=${info1[Absolute upper-left Y]} - else - echo "Selection is not a conky" - $DIALOG --button="OK:0" --button="$EXIT" --text="$NOT_SELECTED" - if (( $? == 1 ));then - echo " Cancelled: exiting..." - exit 0 - fi - getStart - fi -} - -function getFinish(){ # Get new Conky position - unset info2 - declare -A info2 - while read line - do - unset key value - [[ $line != xwininfo:* && $line = *:* ]] && { - key=${line%:*} - value=${line#*:} - info2[$key]=$value - } - done < <(xwininfo -id $ID) - posX_2=${info2[Absolute upper-left X]} - posY_2=${info2[Absolute upper-left Y]} -} - -function getOffset(){ # parse_conkyfile should already have been run - if [[ ${config[alignment]} = none ]];then # placement managed by Openbox - TXT="$ALIGNMENT_NONE" - $DIALOG --text="$TXT" --button="OK" - echo -e "\nConky has 'alignment none',\nso placement is handled by the Window Manager\nExiting...\n" - exit 0 - fi - - OFFSET_X=$(( posX_2 - posX_1 )) - OFFSET_Y=$(( posY_2 - posY_1 )) - - case ${config[alignment]} in - tr|top_right|mr|middle_right|br|bottom_right|mm|middle_middle|bm|bottom_middle|tm|top_middle) - gapX=$(( ${config[gap_x]} - OFFSET_X )) - ;; - tl|top_left|ml|middle_left|bl|bottom_left) - gapX=$(( ${config[gap_x]} + OFFSET_X )) - ;; - esac - case ${config[alignment]} in - tr|top_right|tl|top_left|tm|top_middle) - gapY=$(( ${config[gap_y]} + OFFSET_Y )) - ;; - br|bottom_right|bl|bottom_left|bm|bottom_middle|mm|middle_middle|ml|middle_left|mr|middle_right) - gapY=$(( ${config[gap_y]} - OFFSET_Y )) - ;; - esac -} - -## check necessary tools are installed -required_commands=(xwininfo xprop yad) # array, space-separated words - -error_exit() { - echo "$0 error: $1" >&2 - exit 1 -} - -missing_commands=() -for i in "${required_commands[@]}" -do - hash $i || missing_commands+=(" $i") -done -[[ ${missing_commands[0]} ]] && error_exit "This script requires the following commands: ${missing_commands[*]} -Please install the packages containing the missing commands -and rerun the script." - - -$DIALOG --text="$CLICK" \ - --button="$CHOOSE_CONKY" --button="$EXIT" - -if (( $? == 0 ));then - getStart -else - echo " Cancelled: exiting..." - exit 0 -fi - -$DIALOG --text="$MOVE" \ - --button="OK:0" --button="$EXIT" - -if (( $? == 0 ));then - getFinish -else - echo " Cancelled: exiting..." - exit 0 -fi - -parse_conkyfile "$CONKYPATH" - -getOffset - -edit_conkyfile "$CONKYPATH" "gap_x"=$gapX "gap_y"=$gapY - -exit 0 diff --git a/bin/mb-hotcorners b/bin/mb-hotcorners deleted file mode 100755 index 041df3e..0000000 --- a/bin/mb-hotcorners +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python2.7 -# bl-hotcorners: -# A script for adding hot corners to Openbox. -# Repackaged for BunsenLabs by John Crawley. -# Repackaged for Mabox by Daniel Napora. -# Originally written for CrunchBang Linux -# by Philip Newborough -# ---------------------------------------------------------------------- - -from Xlib import display -from Xlib.ext.xtest import fake_input -from Xlib import X -from subprocess import Popen, PIPE, STDOUT -import sys, time, os, ConfigParser, re - -check_intervall = 0.2 - -p = Popen(['xdotool','getdisplaygeometry'], stdout=PIPE, stderr=STDOUT) -Dimensions = p.communicate() -Dimensions = Dimensions[0].replace('\n', '') -Dimensions = Dimensions.split(' ') -width = int(Dimensions[0]) -height = int(Dimensions[1]) -hw = width / 2 -rt = width - 1 -bt = height - 1 - -def print_usage(): - print "mb-hotcorners: usage:" - print " --help show this message and exit" - print " --kill attempt to kill any running instances" - print " --daemon run daemon and listen for cursor triggers" - print "" - exit() - -if len(sys.argv) < 2 or sys.argv[1] == "--help": - print_usage() - -elif sys.argv[1] == "--kill": - print "Attempting to kill any running instances..." - os.system('pkill -9 -f mb-hotcorners') - exit() - -elif sys.argv[1] == "--daemon": - Config = ConfigParser.ConfigParser() - cfgdir = os.getenv("HOME")+"/.config/mb-hotcorners" - rcfile = cfgdir+"/mb-hotcornersrc" - bounce = 40 - disp = display.Display() - root=display.Display().screen().root - - def mousepos(): - data = root.query_pointer()._data - return data["root_x"], data["root_y"], data["mask"] - - def mousemove(x, y): - fake_input(disp, X.MotionNotify, x=x, y=y) - disp.sync() - - try: - cfgfile = open(rcfile) - except IOError as e: - if not os.path.exists(cfgdir): - os.makedirs(cfgdir) - cfgfile = open(rcfile,'w') - Config.add_section('Hot Corners') - Config.set('Hot Corners','top_left_corner_command', 'dmenu_run') - Config.set('Hot Corners','top_right_corner_command', '') - Config.set('Hot Corners','bottom_left_corner_command', '') - Config.set('Hot Corners','bottom_right_corner_command', '') - Config.write(cfgfile) - cfgfile.close() - - while True: - Config.read(rcfile) - time.sleep(check_intervall) - pos = mousepos() - - if pos[0] == 0 and pos[1] == 0: - if Config.get('Hot Corners','top_left_corner_command') != '': - time.sleep(0.2) - pos = mousepos() - if pos[0] == 0 and pos[1] == 0: - mousemove(pos[0] + bounce, pos[1] + bounce) - os.system('(' + Config.get('Hot Corners','top_left_corner_command') + ') &') - mousemove(pos[0] + bounce, pos[1] + bounce) - time.sleep(2) - - elif pos[0] == rt and pos[1] == 0: - if Config.get('Hot Corners','top_right_corner_command') != '': - time.sleep(0.2) - pos = mousepos() - if pos[0] == rt and pos[1] == 0 : - mousemove(pos[0] - bounce, pos[1] + bounce) - os.system('(' + Config.get('Hot Corners','top_right_corner_command') + ') &') - mousemove(pos[0] - bounce, pos[1] + bounce) - time.sleep(2) - - elif pos[0] == 0 and pos[1] == bt: - if Config.get('Hot Corners','bottom_left_corner_command') != '': - time.sleep(0.2) - pos = mousepos() - if pos[0] == 0 and pos[1] == bt: - mousemove(pos[0] + bounce, pos[1] - bounce) - os.system('(' + Config.get('Hot Corners','bottom_left_corner_command') + ') &') - mousemove(pos[0] + bounce, pos[1] - bounce) - time.sleep(2) - - elif pos[0] == rt and pos[1] == bt: - if Config.get('Hot Corners','bottom_right_corner_command') != '': - time.sleep(0.2) - pos = mousepos() - if pos[0] == rt and pos[1] == bt: - mousemove(pos[0] - bounce, pos[1] - bounce) - os.system('(' + Config.get('Hot Corners','bottom_right_corner_command') + ') &') - mousemove(pos[0] - bounce, pos[1] - bounce) - time.sleep(2) - -else: - print_usage() diff --git a/bin/mcc b/bin/mcc index bc25f25..04d21e5 100755 --- a/bin/mcc +++ b/bin/mcc @@ -61,7 +61,7 @@ case $LANG in MT_MNGR_DESC="\nMotyw Maboxa składa się z:\n - tapety\n - wystroju GTK2/GTK3\n - motywu Openboxa\n - ustawień panelu Tint2\n - uruchamianych automatycznie Conky\n\nZa pomocą menedżera motywów możesz w wygodny sposób zapisywać swoje konfiguracje Maboxa, a następnie dowolnie przełączać się między nimi.\n" ;; *) - MCC="\t\t\t\t\t\t\t Mabox Control Center\n\t\t\t\t\t Configure and customize your Mabox" + MCC="\t\t\t\t\t\t\t\t Mabox Control Center\n\t\t\t\t\t\t Configure and customize your Mabox" SYSTEM="System/Hardware" LOCALE_SETTINGS="Locale Settings" LANGUAGE_PACKAGES="Language Packages" diff --git a/bin/yautostart b/bin/yautostart index f6d42c3..103b252 100755 --- a/bin/yautostart +++ b/bin/yautostart @@ -15,7 +15,7 @@ case $LANG in TITLE="XDG Autostart Editor" DESC="Choose apps/services to autostart" ENABLE="run" - FILE="FIle" + FILE="File" NAME="Name" COMMENT="Comment" NO_DESC="no description" @@ -42,7 +42,7 @@ for f in $config_dir/autostart/*.desktop; do comment=$(grep -m 1 -e '^[[:blank:]]*Comment=' $f | cut -d = -f 2) [ ! -z "$comment" ] && echo $comment || echo "$NO_DESC" done | yad --width=400 --height=400 --title="$TITLE" --image="gtk-execute" \ - --text="" --list --print-all --bool-fmt="t" \ + --text="$DESC" --list --print-all --bool-fmt="t" \ --checklist --column="$ENABLE:CHK" --column="$FILE:HD" --column="$NAME" --column="$COMMENT:HD" --tooltip-column=4 > $results if [[ ${PIPESTATUS[1]} -eq 0 ]]; then