'Minimize/Unminimize window with one shortcut
I am trying to set a shortcut key for:
- xfce4-terminal to open (if its not already running)
- IF running
- Then check if its active
- If Active then minimize it
- If not active then show it (activate it)
By active I mean its open as an active window and not behind some other window.
For which I managed to write this script (Note: I do not know anything about bash scripting)
#!/bin/bash
if (ps aux | grep xfce4-terminal | grep -v grep > /dev/null)
then
if([xfce4-terminal is active])
then
xdotool windowminimize [xfce4-terminal]
else
xdotool [activate xfce4-terminal]
else
xfce4-terminal
exit 0
fi
Please note: anything enclosed in [] is what i want to achieve but have idea what command to use
Then I will save this script to a file and create a shortcut key to run this file and perform desired tasks
Solution 1:[1]
#!/bin/bash
if (ps aux | grep xfce4-terminal | grep -v grep > /dev/null)
then
title=$(xdotool getactivewindow getwindowname)
if [ "$title" = fullscreen ];
then
xdotool search --name fullscreen windowminimize
else
xdotool search --name fullscreen windowactivate
fi
else
xfce4-terminal --title=fullscreen --fullscreen --hide-menubar
fi
DONE :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | NewbieLinux |
