You are not logged in.

#1 2015-10-26 19:10:35

woodape
Member
Registered: 2015-09-29
Posts: 38

Hotcorner script for temporary terminator

Hi All! If you're like me, you often need a terminal to do quick terminal tasks. If you're very much like me and use several (many) workspaces this can often mean you end up with a bunch of terminals open using resouces and genrally taking up space. Some people have drop-down terminals like guake, and some people use uxrvtd so having multiple terminals open doesn't really affect system resoucres - but I don't really like those options, I prefer to use terminator.

So I wrote this little script, which combined with a hotkey or hotcorner (how I use it) checks to see if terminator is open with a forced title of "QuickTerm". If it is, pull it into focus from wherever it is, if it isn't open, open it, and if it's the active window, close it. It requires wmctrl and xdotool:

#!/bin/bash

# Check for the QuickTerm
qt="$(wmctrl -l | grep QuickTerm)"

# Is QuickTerm open?

if [ -z "$qt" ] ; then
	# It's not open, so open it
	terminator -T QuickTerm &
elif [ "$(xdotool getwindowfocus getwindowname)" == "QuickTerm" ] ; then
	# It's currently active, so close it
	wmctrl -c QuickTerm
else
	# It's not currently active, so move it to the current workspace and make it active
	wmctrl -R QuickTerm 
fi

Something I've been thinking about is opening the terminal with screen or tmux, and then the 'elif' statement would including forking the screen session before closing the window, but I'm not sure I want to do that yet. Check it out, let me know what you think!

Last edited by woodape (2015-10-26 19:43:26)

Offline

#2 2017-02-25 17:49:58

martix
Kim Jong-un Stunt Double
Registered: 2016-02-19
Posts: 1,267

Re: Hotcorner script for temporary terminator

Just found this little script and I think it's great!

I also put it on hotcorner and it does what it says: Opens a terminal or moves an open terminal from an other desktop or - if a terminal is already open - it closes that window. @woodape has not been online lately but nevertheless thank you for the script!

Offline

#3 2017-02-27 20:50:39

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Hotcorner script for temporary terminator

PS:

urxvt has a -dockapp switch:

-dockapp
           Sets the initial state of the window to WithdrawnState, which makes window managers
           that support this extension treat it as a dockapp.

how neat is that.

can the openbox dock be activated with a hotkey?

Offline

Board footer

Powered by FluxBB