Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bozso/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
bozso committed Dec 3, 2019
2 parents dbe4a17 + ed2f61f commit 7d984e6
Show file tree
Hide file tree
Showing 4 changed files with 245 additions and 8 deletions.
Empty file modified bin/latexrun
100755 → 100644
Empty file.
16 changes: 8 additions & 8 deletions configs/openbox/lxde-rc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,38 +363,38 @@
</action>
</keybind>
<!-- Snapping windows -->
<keybind key="W-KP_1"> # Lower Left
<keybind key="W-1"> # Lower Left
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>0</x><y>-0</y><height>50%</height><width>50%</width></action>
</keybind>
<keybind key="W-KP_7"> # Upper Left
<keybind key="W-2"> # Upper Left
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>0</x><y>0</y><height>50%</height><width>50%</width></action>
</keybind>
<keybind key="W-KP_3"> # Lower Right
<keybind key="W-3"> # Lower Right
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>-0</x><y>-0</y><height>50%</height><width>50%</width></action>
</keybind>
<keybind key="W-KP_9"> # Upper Right
<keybind key="W-4"> # Upper Right
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>-0</x><y>0</y><height>50%</height><width>50%</width></action>
</keybind>
<keybind key="W-Return">
<action name="ToggleMaximizeFull"/>
</keybind>
<keybind key="W-KP_4"> # HalfLeftScreen
<keybind key="W-5"> # HalfLeftScreen
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>0</x><y>0</y><height>100%</height><width>50%</width></action>
</keybind>
<keybind key="W-KP_6"> # HalfRightScreen
<keybind key="W-6"> # HalfRightScreen
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>-0</x><y>0</y><height>100%</height><width>50%</width></action>
</keybind>
<keybind key="W-KP_8"> # HalfUpperScreen
<keybind key="W-7"> # HalfUpperScreen
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>0</x><y>0</y><width>100%</width><height>50%</height></action>
</keybind>
<keybind key="W-KP_2"> # HalfLowerScreen
<keybind key="W-8"> # HalfLowerScreen
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo"><x>0</x><y>-0</y><width>100%</width><height>50%</height></action>
</keybind>
Expand Down
236 changes: 236 additions & 0 deletions menu.bish
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
progs = "$HOME/progs"
icons = "$progs/utils/icons"
opt = "-fn -adobe-helvetica-bold-r-normal-*-25-180-100-100-p-138-iso8859-1"

def mymenu(args) {
return @(dmenu $opt -i $args)
}

# alias mymenu = "dmenu $opt -i"
# alias dpass = "dmenu $opt -nf \"black\" -nb \"black\" <&-"

temu = "lxterminal"

def debug(args) {
@(notify-send -i "$icons/debug.png" "Debug" "args[0]" -t 2500)
}

def perr(args) {
@(printf "%s\n" "$args" >&2;)
}


def check_narg(one, two) {
if (one > two) {
perr("error: Wrong number of arguments!")
return 1
}
}


def dprompt(txt, cmd) {
if (@(printf "No\nYes" | mymenu -p $txt) == "Yes") {
@(cmd)
}
}


def notify(head, msg, icon) {
if (len(icon) > 0) {
@(notify-send -i $icons/$icon $head $msg -t 1500)
} else {
@(notify-send $head $msg -t 1500)
}
}

def extract_music() {
for (zipfile in @("/tmp/*.zip") {
local outpath = "/home/istvan/Zenék/@(basename $zipfile .zip)"
notify("Extracting file", $zipfile)
@(unzip $zipfile -d $outpath)
}
}


def last_field() {
return @(awk -F '/' '{print $NF}')
}


def playlists() {
local path = "/home/istvan/Zenék/playlists"

local sel = @(ls -1 $path/* | last_field | \
mymenu("-p", "Select music:")

if (len(sel) > 0) {
local path = "$path/$sel"
notify("Playing music", $sel, "music_note.png")
@(parole $path &)
}
}


# workspace() {
# check_narg $# "2"
#
# local name="$1"
# local path="$2"
#
# tmux start-server
#
# echo "$name $(tmux ls)"
# local bool="$(in_str "$name" "$(tmux ls)")"
# echo "$bool"
#
# if [ "$bool" = "false" ]; then
# notify "tmux" "Starting session $name"
# tmux new-session -d -t "$name"
# tmux send-keys "cd $path" C-m
# tmux split-window -h -c "$path"
# tmux select-pane -t 2
# tmux send-keys "mc" C-m
# tmux split-window -v -c "$path"
# tmux select-pane -t 1
# fi
#
# $temu -e "tmux attach-session -d -t \"$name\""
#
# }

# work() {
# local sel="$(dselect "$repos" "Select repo:")"
# local path="$(mget "$sel" "$repos")"
#
# workspace "$sel" "$path"
# }


# mc() {
# local sel="$(ls -d -1 $HOME/*/ | \
# awk -F '/' '{print $(NF - 1)}' | \
# mymenu -p "Select directory:")"
#
# if [ -n "$sel" ]; then
# local path="$HOME/$sel"
# notify "Started Midnight Commander." "$path" "mc.png"
# $temu -e "mc $path"
# fi
# }


# ssh() {
# local select=$(printf "robosztus\nzafir\n" | mymenu -p "Select server")
#
# local header="Connecting to remote machine."
#
# case $select in
# "robosztus")
# notify "$header" "istvan@robosztus.ggki.hu" "ssh.png"
# $temu -e 'ssh -Y istvan@robosztus.ggki.hu'
# ;;
# "zafir")
# notify "$header" "istvan@zafir.ggki.hu" "ssh.png"
# $temu -e 'ssh -Y istvan@zafir.ggki.hu'
# ;;
# *)
# printf "Unknown option: %s!\n" $select
# esac
# }

# shutdown_now() {
# notify-send "Did you push all git repositories?" \
# "Check git repositories!" -u "critical" -i "$icons/warning.png"
# dprompt "Shutdown?" "shutdown -h now"
# }


# gamma() {
# local path="/home/istvan/Dokumentumok/gamma_doc"
#
# local sel=$(ls -1 $path/*.html | last_field | \
# mymenu -p "Select program:" -l 10)
#
# if [ -n "$sel" ]; then
# local path="$path/$sel"
# notify "Opening documentation" "${sel}" "music_note.png"
# chromium-browser "${path}"
# fi
# }

# modules="
# playlists
# git
# mc
# ssh
# repos_all
# extract_music
# work
# gamma
# "
#
#
# select_module() {
# local log="$HOME/menu.log"
# local sel=$(printf "%s\n" $modules | mymenu -p "Select from modules:")
#
# for module in $(printf "%s\n" $modules); do
# case $sel in
# $module)
# $module > $log
# ;;
# *)
# ;;
# esac
# done
# }
#
# Basename() {
# while IFS= read -r line; do
# printf '%s\n' "$(basename $line .png)"
# done
# }
#
# import() {
# local root="${HOME}/screencap"
# mkdir -p "${root}"
#
# last="$(ls ${root}/img_*.png \
# | Basename \
# | tr -d '[:alpha:]' \
# | tr -d '_' \
# | sort -g \
# | tail -1)"
#
# new=$((last+1))
#
# import "${root}/img_${new}.png" > "${HOME}/import.log"
# }
#
# main() {
# check_narg $# 1
#
# case $1 in
# "programs")
# dmenu_run $opt
# ;;
# "modules")
# select_module
# ;;
# "markdown")
# markdown $2
# ;;
# "shutdown")
# shutdown_now
# ;;
# "import")
# import
# ;;
# *)
# printf "Unrecognized option %s!\n" $1 >&2
# return 1
# ;;
# esac
# }
#
# main "$@"
1 change: 1 addition & 0 deletions menu.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dprompt() {


notify() {
return
if [ -n "$3" ]; then
notify-send -i "$icons/$3" "$1" "$2" -t 1500
else
Expand Down

0 comments on commit 7d984e6

Please sign in to comment.