Skip to content

Instantly share code, notes, and snippets.

@pymen
Last active January 1, 2016 16:59
Show Gist options
  • Save pymen/8174067 to your computer and use it in GitHub Desktop.
Save pymen/8174067 to your computer and use it in GitHub Desktop.
Konsole and krusader quake-style start, activate of hide by one command set hotkey and have fun!
name="Krusader";
session_num=$(qdbus org.kde.konsole /Konsole newSession)
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 0 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 1 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num sendText "cd $1"
sleep 0.03
win_id=$(qdbus org.kde.konsole /konsole/MainWindow_1 winId);
xdotool windowactivate --sync $win_id;
sleep 0.03
xdotool key --window $win_id 'Return'
#!/bin/sh
pid=$(pidof -s konsole);
if [ "$pid" = "" ]; then
dbus_path="org.kde.konsole /konsole/MainWindow_1";
else
dbus_path="org.kde.konsole-$(pidof -s konsole) /konsole/MainWindow_1";
fi;
win_id=$(qdbus ${dbus_path} winId)
# qdbus $(org.kde.konsole-$(pidof -s konsole) /konsole/MainWindow_1) winId
if [ "$win_id" = "" ]; then
win_id=$(qdbus org.kde.konsole /konsole/MainWindow_1 winId)
fi;
echo $win_id;
if [ "$win_id" != "" ]; then
top_title=$(xdotool getwindowname $(xdotool getwindowfocus)| grep -o Konsole)
if [ "$top_title" != "Konsole" ]; then
xdotool windowmap $win_id;
wmctrl -i -a $win_id -e 0,50,600,1600,400
xdotool windowactivate $win_id;
else
xdotool windowunmap $win_id
fi;
else
konsole
win_id=$(qdbus ${dbus_path} winId)
wmctrl -i -a $win_id -e 0,50,600,1600,400
fi;
#!/bin/sh
#qdbus | grep krusader
dbus_path="org.krusader.krusader-$(pidof -s krusader) /krusader/MainWindow_1"
win_id=$(qdbus ${dbus_path} winId)
top_title=$(xdotool getwindowname $(xdotool getwindowfocus)| grep -o Krusader)
if [ "$win_id" != "" ]; then
if [ "$top_title" != "Krusader" ]; then
xdotool windowmap $win_id;
xdotool windowraise $win_id;
xdotool windowfocus $win_id
xte 'key Escape'
else
xdotool windowunmap $win_id
fi;
else
krusader
fi;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment