https://github.com/bulletmark/raise-or-run
Linux shell script to raise app window, or run app if window not already open
https://github.com/bulletmark/raise-or-run
bash bash-script wmctrl
Last synced: 10 months ago
JSON representation
Linux shell script to raise app window, or run app if window not already open
- Host: GitHub
- URL: https://github.com/bulletmark/raise-or-run
- Owner: bulletmark
- Created: 2018-09-10T05:06:19.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-09-06T00:53:54.000Z (almost 4 years ago)
- Last Synced: 2025-04-22T10:41:56.868Z (about 1 year ago)
- Topics: bash, bash-script, wmctrl
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## RAISE-OR-RUN
[](https://aur.archlinux.org/packages/raise-or-run/)
This is is a simple bash script which is called with an argument app and
file which you want to open. If there is already a window open with that
app's window manager class for the specific file you want to open then
that window is raised and given focus, otherwise if there is no window
already open for that file, then the app is started with that file as
the argument. It can be used with multiple independent files, each opened in
parallel in their own app window. This script uses
[wmctrl](https://sites.google.com/site/tstyblo/wmctrl) to determine the
classes and file names of already open windows, and also to select an
open window.
Note that this tool works only for applications running on Xorg. It does
not work for Wayland native applications. Of course, it does work for
Xorg applications running on Wayland, via XWayland.
The latest version and documentation is available at
http://github.com/bulletmark/raise-or-run.
### INSTALLATION
NOTE: Arch users can just install [raise-or-run from the
AUR](https://aur.archlinux.org/packages/raise-or-run/) and skip to the next
section. Otherwise, do the following.
You require the [bash](https://www.gnu.org/software/bash/) shell and the
[wmctrl](https://sites.google.com/site/tstyblo/wmctrl)
package. Then type:
git clone http://github.com/bulletmark/raise-or-run
cd raise-or-run
sudo make install
### USAGE
I use this for the [KMyMoney](https://kmymoney.org/) program which
[incorrectly handles multiple files](https://bugs.kde.org/show_bug.cgi?id=350850).
If you click on a file which is already open the it tries to open the
file again and creates an error. So I change the `Exec` line in the
`/usr/usr/applications/org.kde.kmymoney.desktop` file from:
Exec=kmymoney %u
to:
Exec=/usr/bin/raise-or-run kmymoney %u
Now when I click on a [KMyMoney](https://kmymoney.org/) file, it jumps
to an open window if one exists for that file, or if not then it starts
the app to open that file in a new window. This works also when you have
multiple but independent KMyMoney files being opened in multiple
parallel windows.
Usage: raise-or-run [-options] [file]
Options
-c Use specified class instead of assuming app name as WM class
### UPGRADE
cd raise-or-run # Source dir, as above
git pull
sudo make install
### UNINSTALL
cd raise-or-run # Source dir, as above
sudo make uninstall
### LICENSE
Copyright (C) 2018 Mark Blakeney. This program is distributed under the
terms of the GNU General Public License.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License at for more details.