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

[REQUEST] Focus Last Window by Default #2084

Closed
2 tasks done
sl5net opened this issue Jan 16, 2025 · 3 comments
Closed
2 tasks done

[REQUEST] Focus Last Window by Default #2084

sl5net opened this issue Jan 16, 2025 · 3 comments

Comments

@sl5net
Copy link

sl5net commented Jan 16, 2025

Before opening a feature request

  • I checked the next branch to see if the feature has already been implemented
  • I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

I'm using Rofi as my task switcher in Ubuntu. When I open it (typically by typing rofi), it shows a list of all open windows. However, by default, it selects the currently active window, which is not what people usually need. I want it to select the last focused window instead, so I can quickly switch between my two most recent applications.

I've tried using the command rofi -show window -window-match current -location -1

seems to be incorrect. thanks for any tips

i also have asked it here:
https://askubuntu.com/questions/1538311/rofi-task-switcher-not-selecting-last-focused-window-by-default-how-to-fix-and

How do you know that this problem exists today? Why is this important?

However, by default, it selects the currently active window, which is not what people usually need. I want it to select the last focused window instead, so I can quickly switch between my two most recent applications.

Who will benefit from it?

i guess everybody.

Rofi version (rofi -v)

Version: 1.7.5

Configuration

https://gist.github.com/sl5net/60e2cf9f348c0d886e9ba098159a0866

Additional information

No response

@DaveDavenport
Copy link
Collaborator

This information is not available to rofi in a WM agnostic way. For some window managers there are programs/scripts you can download that run in the background and keep track of focus to provide this functionality.

@DaveDavenport DaveDavenport closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@DaveDavenport
Copy link
Collaborator

For some WM's it is enough to pass rofi -show window -selected-row 1 as they report the windows in the right order.

@sl5net
Copy link
Author

sl5net commented Feb 15, 2025

For some WM's it is enough to pass rofi -show window -selected-row 1 as they report the windows in the right order.

thank. it sometimes hangs on first line. with all solutions i tried.

#!/bin/bash

# rofi -show window -selected-row 1
# works also but sometimes it hangs on first line.

# maybe with follwoing its a bit better - nur sure:

rofi -show &
sleep 0.8 # Wait for Rofi to get focus (adjust as needed)

# Send the 'Down' arrow key (without specifying a window)
# needs xdotool
# sudo pacman -S xdotool
xdotool key Down 2>/dev/null

maybe you also like:

#!/bin/bash
# rofi-down-enter.sh
rofi -show &
sleep 0.3  # Wait for Rofi to get focus (adjust as needed)

# Send the 'Down' arrow key
xdotool key Down 2>/dev/null

# Send the 'Enter' key
xdotool key Return 2>/dev/null

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

No branches or pull requests

2 participants