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

Issues with tofi on river and dual monitor setup #173

Open
niels0n opened this issue Jun 5, 2024 · 7 comments
Open

Issues with tofi on river and dual monitor setup #173

niels0n opened this issue Jun 5, 2024 · 7 comments

Comments

@niels0n
Copy link

niels0n commented Jun 5, 2024

Using river, if I launch tofi while a window is open and focused on my first monitor, tofi spawns on the second monitor instead and I have to go on that monitor, click on it (even if focus should follow cursor so it shouldn't be necessary), and then interact with tofi.

If I haven't any open window on the first monitor it works just fine.
On my second monitor this problem doesn't happen, having open windows or not it's irrelevant, and it works even if I have an open window on my first monitor, but the second is focused.

So the problem happen only when tofi is launched while focusing a window in the first monitor.
That's weird. This is my config, maybe you can spot something wrong there.

anchor = center
width = 100%
height = 1440
horizontal = true
font-size = 20
prompt-text = "run: "
font = Tamzen Bold
outline-width = 0
border-width = 0
background-color = #000000
selection-background = #f1c40f
selection-color = #000
selection-padding = 10
input-color=#999
min-input-width = 200
result-spacing = 25
padding-top = 40%
padding-bottom = 0
padding-left = 100
padding-right = 100
margin-left = 0

hide-cursor=true
hint-font = false
text-cursor=true
text-cursor-color=#FFF
drun-launch = true

EDIT: Just tried without config. Same result, so I don't think the problem is there.

@redbeardymcgee
Copy link

I'm having the problem exactly as originally described. Version 0.9.1.

@ideasman42
Copy link

ideasman42 commented Jul 4, 2024

This is a quick workaround for the issue:

diff --git a/src/main.c b/src/main.c
index e91838f..b2cd429 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1576,7 +1576,7 @@ int main(int argc, char *argv[])
 	tofi.window.zwlr_layer_surface = zwlr_layer_shell_v1_get_layer_surface(
 			tofi.zwlr_layer_shell,
 			tofi.window.surface.wl_surface,
-			wl_output,
+			nullptr,
 			ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
 			"launcher");
 	zwlr_layer_surface_v1_set_keyboard_interactivity(

It might be nice to have a preference to disable automatic output selection.

@githubdontbanmeagain
Copy link

Can the maintainer actually fix this? It's been months

@riadbelaid
Copy link

riadbelaid commented Nov 23, 2024

Pending a fix, the kludge I've been using relies on setting the output configuration option to the currently focused monitor before executing Tofi. Here's my implementation for Sway:

First, add this line to the Tofi configuration:

output =

Then execute this command (jq needs to be installed on the system):

sed --in-place "s/output =.*/output = $(swaymsg --type get_outputs | jq '.[] | select(.focused).name')/" ~/.config/tofi/config && tofi-run | xargs swaymsg exec --

@photosheep
Copy link

I noticed this issue and have been a bit more annoyed this week. It seems like #189 fixes the issue on my end.

@githubdontbanmeagain
Copy link

Pending a fix, the kludge I've been using relies on setting the output configuration option to the currently focused monitor before executing Tofi. Here's my implementation for Sway:

First, add this line to the Tofi configuration:

output =

Then execute this command (jq needs to be installed on the system):

sed --in-place "s/output =.*/output = $(swaymsg --type get_outputs | jq '.[] | select(.focused).name')/" ~/.config/tofi/config && tofi-run | xargs swaymsg exec --

Didn't work for me on hyprland with hyprctl dispatch instead of swaymsg

@riadbelaid
Copy link

Didn't work for me on hyprland with hyprctl dispatch instead of swaymsg

Are you executing the command before Tofi on each invocation? E.g.:

bindsym Mod4+D exec sed --in-place "s/output =.*/output = $(swaymsg --type get_outputs | jq '.[] | select(.focused).name')/" ~/.config/tofi/config && tofi-run | xargs swaymsg exec --

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

6 participants