Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change behaviour? #65

Closed
gitlerat opened this issue May 26, 2021 · 3 comments
Closed

change behaviour? #65

gitlerat opened this issue May 26, 2021 · 3 comments

Comments

@gitlerat
Copy link

Hi is it possible to change the script that it creates the window firsttime and then minimize the window when it is already launched - and if it is launched but hidden, than rise the window?

kind regards

@gitlerat
Copy link
Author

gitlerat commented Jun 7, 2021

`#!/bin/bash
#Get focused window
focused_wid=$(xdotool getactivewindow)
#Get focused window class
focused_wm_class=$(cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm)
# And list of windows
xdotool search --class . > /tmp/widids

if [[ "$focused_wm_class" == "$1" ]];
then
# Check if the window is in the list (returns nothing if it's not)

$focused_wid=$(awk -v var="$focused_wid" '$0 ~ var' /tmp/widids)
$(xdotool windowminimize "$focused_wid")

else
$(wmctrl -xa "$1" || "$2")
fi`

@gitlerat
Copy link
Author

gitlerat commented Jun 7, 2021

The Aboce Code does following:

launch the application if there is no instance open,

if launched but not in focus it will focus it,

if it is launched and focused it will minimize it

Sadly it is still not working on flatpaks because I am working with the process name and it seems that there is still a quirk

@mkropat
Copy link
Owner

mkropat commented Jun 11, 2021

Have you tried the -m option that was introduced in #41 ? It sounds similar to what you are describing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants