deskmnngr upd
parent
3d81bc66ba
commit
869d6238f9
25
bin/deskmngr
25
bin/deskmngr
|
@ -3,6 +3,7 @@
|
|||
#: deskmngr - save all programs (windows) running on current desktop in session file.
|
||||
#: With windows positions and state (decorated or not)
|
||||
#: Usage:
|
||||
#: -l|listsessions - list saved sessions
|
||||
#: -s|save - save session from current desktop
|
||||
#: -r|restore sesionfile desktop_ID - restore session from sessionfile on desktop
|
||||
#:
|
||||
|
@ -22,11 +23,26 @@
|
|||
SESSIONDIR="$HOME/.config/deskmngr/"
|
||||
mkdir -p $SESSIONDIR
|
||||
|
||||
case "$LANG" in
|
||||
pl*)
|
||||
TITLE="Nie ma nic do zapisania"
|
||||
TEXT="\nWygląda na to że nie ma otwartych okien na bieżącym pulpicie.\nUruchom jakieś programy i spróbuj ponownie.\n"
|
||||
SAVE_AS="Zapisz sesję jako:"
|
||||
SESSNAME="Nazwa sesji"
|
||||
;;
|
||||
*)
|
||||
TITLE="Nothing to save"
|
||||
TEXT="\nLooks like there are no windows to save on current desktop.\n Run some programs and try again.\n"
|
||||
SAVE_AS="Save session as:"
|
||||
SESSNAME="Session name"
|
||||
;;
|
||||
esac
|
||||
|
||||
savesession() {
|
||||
curdesk=$(wmctrl -d | grep "*" | awk '{print $1}')
|
||||
if [ $(wmctrl -l -p -G | awk -v c=$curdesk '$2 == c {print $2}' | wc -l) == "0" ];then notify-send -i dialog-warning "Nothing to save" "\nStart some programs and try again.\n";exit 1;fi
|
||||
if [ $(wmctrl -l -p -G | awk -v c=$curdesk '$2 == c {print $2}' | wc -l) == "0" ];then notify-send -i dialog-warning "$TITLE" "$TEXT";exit 1;fi
|
||||
|
||||
filename=$(yad --center --title "Save session as:" --entry --entry-label="Session name" --entry-text="Session name") || exit 1
|
||||
filename=$(yad --center --title "$SAVE_AS" --entry --entry-label="$SESSNAME" --entry-text="$SESSNAME") || exit 1
|
||||
windows=()
|
||||
wmctrl -l -p -G | {
|
||||
while IFS= read -r line
|
||||
|
@ -47,7 +63,7 @@ savesession() {
|
|||
fi
|
||||
done
|
||||
if [ ${#windows[@]} -eq 0 ]; then
|
||||
notify-send -i dialog-warning "Nothing to save" "Opps, looks like there are no windows to save on current desktop.\n Run some programs and try again ;)"
|
||||
notify-send -i dialog-warning "$TITLE" "$TEXT"
|
||||
else
|
||||
printf "%s\n" "${windows[@]}" > "$SESSIONDIR/${filename// /_}.desk"
|
||||
# Serch replace
|
||||
|
@ -96,6 +112,9 @@ restoresession() {
|
|||
done
|
||||
}
|
||||
}
|
||||
overwrite() {
|
||||
echo "Not implemented"
|
||||
}
|
||||
|
||||
listsessions() {
|
||||
ls -1 ${SESSIONDIR}
|
||||
|
|
Loading…
Reference in New Issue