Linux minimize all windows

Linux minimize all windows

Show desktop != Minimize all windows

In my opinion Show desktop should show the desktop as it says and Minimize all windows should minimize all the running applications in taskbar and not the ones in system tray. This is quite helpful if like me, you use sticky notes such as Xpad to keep track of everything.

And I could not find any shortcuts that would let me do so in Linux Mint. So, I created two shell scripts and used it to accomplish the above.

To do that, first install devilspie using the command:

sudo apt-get update && sudo apt-get install devilspie

Next, you need to create some devilspie scripts to do the job for you and save those to ~/.devilspie.

( if
( begin
( not ( is ( window_name ) «Conky (yourPCname )» ) )
)
( begin
( minimize )
)
)

So, what this devilspie does is that it minimizes all windows except Conky. Save this script as somename1.ds

( if
( begin
( is ( window_name ) «Desktop» )
)
( begin
( unminimize )
)
)

This devilspie unminimizes the desktop. Save this script as somename2.ds

Now, from the third devildpie onwards, add the applications you want to keep in desktop after the shortcut is pressed. For e.g., plank, xpad, etc.

( if
( begin
( is ( window_name ) «plank» )
)
( begin
( unminimize )
)
)

The above script unminimizes plank. Save this script as somename3.ds

( if
( begin
( is ( application_name ) «Xpad» )
)
( begin
( unminimize )
)
)

The above script unminimizes xpad. Save this script as somename4.ds

Next, you need to create a shell script:

cd ~/.devilspie
devilspie somename1.ds somename2.ds somename3.ds somename4.ds

Save the above script as somenamesh1.sh

Next, you need to add this script to custom shortcut. So, head over to System Settings > Keyboard > Custom Shortcuts > Add custom shortcut

There, enter any name to your liking and as command do:

By now, you should be able to minimize all windows except the windows you want to keep. But, there’s a slight glitch in that. Your script keeps on running and when you open a new window, it starts minimized. To overcome this issue, you need the other script:

while true
do
pkill «devilspie»
sleep 1
done

Save this script as somenamesh2.sh and add this script to your list of startup applications. Also, you don’t need to worry about the resource taken by the above script as after 7 days of continuous usage on my PC (without any shutdown), it utilizes a maximum of 460 KiB RAM and 0% CPU.

Источник

Minimize multiple windows at once

I am using Ubuntu 18.04 with GNOME. I would like to know if there is any functionality that allows to associate multiple windows in such a way that when one of the windows is minimized all the other are too and when the window is restored all the others too. I.e. I am working with multiple terminal windows and I would like to group the terminals in N groups, in such a way that when I minimize a terminal window all other terminal windows that belong to that group get minimized too.

Читайте также:  Linux gpg trust key

If you want to minimize all windows, use the Hide all normal windows shortcut. By default it is not assigned in Gnome. But, I set it to Super + M to mimic MS Windows usage. (Go to Settings | Devices | Keyboard | Navigation to set it.)

3 Answers 3

The following procedure is only for $XDG_SESSION_TYPE x11.

  • It uses xdotool which is in the Universe repository.
  • It assumes you’ve categorized your terminal windows in such a way that each group has a common string in the title (not present in any other open windows).
  • In the example below, there are two groups each with three open gnome-terminal windows:
    • Earth 1
    • Earth 2
    • Earth 3 and
    • Wind 1
    • Wind 2
    • Wind 3

    Important:
    To ensure that the terminal window’s title does not change, I had to first comment out the following lines from ~/.bashrc. If this is not done, the title will reflect the current working directory instead of retaining the title you set:

    case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;$\u@\h: \w\a\]$PS1" ;; *) ;; esac 

    I named each window using

    Note that xdotool, as used here, won’t handle windows named using

    wmctrl -r :ACTIVE: -N "New title" 

    The following animated gif will illustrate using another «master» terminal, located at the top of the screen in the image, to issue code to minimize or maximize a particular group of windows.

    To do so, I added the following functions to my ~/.bashrc:

    • mmm uses xdotool to search for the string «KEYWORD» provided by the user. «earth» in this example, is common to one group of terminal windows to be acted on. xdotool produces their window identifiers which is directed to a temporary file.
    • xwn uses xdotool‘s windowminimize action to minimize the windows specified in the temporary file.
    • xwx uses xdotool‘s windowactivate action to maximize the windows specified in the temporary file.
    • Note that, depending on what else has been done, it maybe necessary to run mmm immediately before xwn or xwx .

    I had to use mogrify -type Grayscale -depth 7 *.png to scale down the size of the gif.

    I’m not aware of anything that provides exactly what you’re looking for, but you can try this kinda ugly workaround by following the steps below.

    1. Set Ubuntu dock to show windows only from the current workspace.
    2. Enable ‘minimise on click’ on Ubuntu dock. Once you do this, you’ll be able to minimise or restore all windows belonging to a specific application from the current workspace by clicking its icon in the dock.
    3. Use different workspaces to group the windows, e.g. keep all the Terminal windows belonging to the first group in workspace 1, second group in workspace 2 and so on.

    Ubuntu 19.04 I have not tested this script , feel free to correct me on those keystrokes. you could use a script to minimise the window and other windows by selecting them from a names list and sending the minimise keystroke to them. unfortunately I do not see minimise window shortcut in Gnome keyboard shortcuts. set a shortcut key in Gnome to run this script. keydown alt + space release then m (or enter as minimise is the first in my window min/max/move list) would do the trick though, xdotool keystrokes help here https://www.linux.org/threads/xdotool-keyboard.10528/

    #!/bin/bash names="Firefox Thunderbird Kate Konsole" echo "$names" for name in $names do # search --onlyvisible --name "$name") search --desktop 0 --class "$name") echo $name $id if [ "x$id" = "x" ] then echo " window not found for "$name"" else xdotool windowactivate --sync $id key -- clearmodifiers --delay 100 keydown alt+space xdotool windowactivate --sync $id key -- clearmodifiers --delay 100 key enter # you can set sleep by a lesser value here like a fraction 0.1 sleep 1 fi done 

    Источник

    Is there any command to minimize windows? [duplicate]

    I work all-around in Ubuntu 14.04 with many programs opened, among them the terminal. It would be very useful to me a command to minimize and maximize windows.
    I have searched in the web using various languages for my search, but I’ve found anything about a command like that.
    It seems to me impossible that so basic commands do not exist yet.

    1 Answer 1

    Open your terminal and paste following command

    sudo apt-get install xdotool 

    execute below command in terminal

    To minimize all windows hotkey is Control-Super-D so

    will minimize and one more thing is you can use alias and can give a name to call this command.

    in future, just give the complete answer at once in a case like this. The original answer came across as though it wasn’t really answering the question.

    Thanks @Raja for the answer. It worked. I have proven xdotools and wmctrl, as it was suggested in the previous question about this subject (I hadn’t seen that one, sorry for this duplicate). Nevertheless those commands only work if you want to manage a single window from the terminal each time; they seem to not work if you want to send an order to many windows. For example, I have opened two windows of Cherrytree (its filenames end with .ctx or .ctb), and I send xdotool search —name ctx windowminimize and only one of two windows get the order. That’s similar for wmctrl

    Источник

    Is there a keyboard shortcut for minimizing all windows except the active one?

    When opening programs like GIMP, I find having background windows open distracting because GIMP has three separate windows associated with it. It’s a burden to have to go to every other non-Gimp window manually to minimize it. What I need is a keyboard shortcut in Ubuntu that matches Windows’ Super + Home shortcut. One that minimizes all windows except the active one. Is it possible to achieve this behavior in Ubuntu?

    Interesting idea! Have a look at the 1st answer here for pointers: askubuntu.com/questions/13709/… That post is about adding a function to minimize all. From looking at it adding a line ‘maximize previous current active’ or changing it to ‘minimize except current active one’ after it would do the trick(?)

    any chance the developers will add a «Minimize All But The Active Window» option in the Keyboard Shortcut menu in future Ubuntu versions? This way this bind is «ready and waiting» to be configured when users install Ubuntu?

    5 Answers 5

    It is possible to achieve this with a python script. The script requires python-wnck and python-gtk to be installed in order to work, although I think these are installed by default anyway.

    Copy and paste this into a text editor and save in a sensible place (eg. as minimise.py in your home folder):

    #!/usr/bin/env python import wnck import gtk screen = wnck.screen_get_default() while gtk.events_pending(): gtk.main_iteration() windows = screen.get_windows() active = screen.get_active_window() for w in windows: if not w == active: w.minimize() 

    You can then set up the keyboard shortcut by opening Keyboard Shortcuts.

    Keyboard Shortcuts in Dash

    Click on Add to create a new shortcut.

    Keyboard Shortcuts window

    Use the command bash -c ‘python ~/minimise.py’ (this is assuming you saved it as minimise.py in your home folder).

    create shortcut

    You can then assign your preferred keyboard combination to this action.

    The script will minimise all non-active windows. I don’t think this is very useful for your use case because you will want to have all of the Gimp windows open. You can use a slightly different script to minimise all windows that aren’t from the current application instead:

    #!/usr/bin/env python import wnck import gtk screen = wnck.screen_get_default() while gtk.events_pending(): gtk.main_iteration() windows = screen.get_windows() active_app = screen.get_active_window().get_application() for w in windows: if not w.get_application() == active_app: w.minimize() 

    Источник

Оцените статью
Adblock
detector