H3rmt / hyprswitch

A CLI/GUI that allows switching between windows in Hyprland
https://crates.io/crates/hyprswitch
MIT License
220 stars 7 forks source link

Unable to parse Hyprland Version #76

Open M3t4k0n opened 1 week ago

M3t4k0n commented 1 week ago

Hello,

I'm getting the following error when trying to run hyprswitch: "WARN Unable to parse Hyprland Version

Caused by: empty string, expected a semver version"

Running Hyprland on Arch, freshly updated everything today, used yay to install hyprswitch, tried running it with different arguments but I'm always getting the same error. screenshot_14112024_232327

H3rmt commented 1 week ago

I recently added a check toward the user if the hyprland version is to old t run the current version of hyprswitch. I used the git tag to determine the version, but I forgot that compiling from source means there is no git tag. However the version command has a version field in the newest release. The whole version check is optional and hyprswitch should run regardless. What is the output of hyprctl version -j?

H3rmt commented 6 days ago

Btw, hyprswitch will still work if it is unable to access the version, as there is no reliable way to get the hyprland version if you have hyprland-git pre 0.44 installed

zonk911 commented 4 days ago

HI, i just updated hyprland to 0.45.1 and after that i updated to hyprswitch 3.1.1. I think i was coming from hyprswitch version 3.0.0. With a semi working setup. Switch to app happened, but no GUI was shown. This is why i wanted to update.
I took one of the latest example configs and replaced my old one. When i run hyprctl version -j i get version 0.45.1 as the current version. My issue is: I always get an notification when i want to switch to another app. 2024-11-18-235522_hyprshot I also restarted the system. Nothing helped. UI is shown, but switch does not work, the next app does not get selected. It seems that the process of cycling through the app list is interrupted by the error. I still get the error that the hyprland version can not be parsed, even though i have hyprland 0.45.1 running.

Hope all of this helps

H3rmt commented 3 days ago

Can you run your hyprswitch -vvv init ... command in a terminal and check the output.

To see the output of the client you can then run hyrswitch -vvv gui ... in a terminal.

Use the same arguments used in your config

zonk911 commented 3 days ago

hyprswitch -vvv init

TRACE Hyprland Version { branch: "", commit: "", dirty: true, commit_message: "", commit_date: "", tag: "", commits: "", build_aquamarine: "0.5.0", flags: ["debug"] }
INFO Starting Hyprswitch (3.1.1) on Hyprland 
WARN Unable to parse Hyprland Version
Caused by:
    empty string, expected a semver version
DEBUG Checking if daemon is running
TRACE Daemon not running: Connection refused (os error 111)
INFO Starting daemon
TRACE client_data:  ...

No other error or warning. But probably line 1 is interesting. Cause version is missing in there. Not just empty, its completely omitted. When i run hyprctl version -j i get

{
    "branch": "",
    "commit": "",
    "version": "0.45.1",
    "dirty": true,
    "commit_message": "",
    "commit_date": "",
    "tag": "",
    "commits": "",
    "buildAquamarine": "0.5.0",
    "flags": ["debug"]
}

When i run hyprland --version i get:

Hyprland 0.45.1 built from branch  at commit  dirty ().
Date: 
Tag: , commits: 
built against aquamarine 0.5.0

flags set:
debug

When i run hyprswitch -vvv gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=mod=grave && hyprswitch dispatch i get:

 TRACE Hyprland Version { branch: "", commit: "", dirty: true, commit_message: "", commit_date: "", tag: "", commits: "", build_aquamarine: "0.5.0", flags: ["debug"] }
INFO Starting Hyprswitch (3.1.1) on Hyprland 
WARN Unable to parse Hyprland Version

Caused by:
    empty string, expected a semver version
DEBUG Checking if daemon is running
INFO initialising daemon
TRACE Sending init command Transfer { transfer: Init(Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_type: Client }, GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease, reverse_key: Mod("grave"), hide_active_window_border: false }), version: "3.1.1" }
WARN Unable to parse Hyprland Version

Caused by:
    empty string, expected a semver version

The GUI appears and when i click on it, the switch happens and i do not get an error. But when i try to do it with the keyboard, the switch does not work and i get an error notification. And i'll skip the output from the hyprswitch trace logs, cause it is mainly Icons and client data.

Hope this helps

H3rmt commented 3 days ago

When running hyprswitch from the terminal with hyprswitch GUI works, but using the keyboard doesn't, this means the hyprswitch run from the keypress isn't the same version as when run when starting from the terminal.

What install methods did you use and do you have it installed from multiple sources?

H3rmt commented 3 days ago

I noticed hyprland removed nearly all of the info in the version command...

zonk911 commented 3 days ago

One more update. I got an update for hyprland right now and installed it via pacman -Syyu Old version 0.45.1-1 New version 0.45.1-2 Now the parsing issue is gone, but i still get errors while switching with the keyboard.

TRACE Hyprland Version { branch: "", commit: "500d2a3580388afc8b620b0a3624147faa34f98b", dirty: false, commit_message: "[gha] Nix: update inputs", commit_date: "Mon Nov 18 14:29:06 2024", tag: "v0.45.1", commits: "5448", build_aquamarine: "0.5.0", flags: ["debug"] }
INFO Starting Hyprswitch (3.1.1) on Hyprland v0.45.1
DEBUG Checking if daemon is running
TRACE Daemon not running: Connection refused (os error 111)
INFO Starting daemon
H3rmt commented 3 days ago

Run the daemon in a terminal (hyprswitch init ...)

zonk911 commented 3 days ago

Yeah i do run hyprswitch in the terminal, i killed the instance which started at startup with pkill and now i watch the output in the terminal. One more thing i discovered now. If i press alt_l + tag and then immediately release the key, the transfer to the other window works, but i still get the error notification. When i press alt_l + tab and hold alt afterwards and then press tab again (cycling through windows) the red border does jump back to the current window i'm currently on. I'll clean up my logs and will try to isolate it with not to much clutter.

zonk911 commented 3 days ago

nohup hyprswitch -vvv init & i pressed alt_l + tab released tab and pressed tab again. I expeect the next window been selected, but the selection always jumps back. nohup.log Update: The next window gets selected, but after that the cycling through does not work and the selection jumps always back.

H3rmt commented 3 days ago

did you use the following example:?

exec-once = hyprswitch init --show-title &
$key = tab
$reverse = grave

bind = alt, $key, exec, hyprswitch gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse --sort-recent && hyprswitch dispatch
bind = alt $reverse, $key, exec, hyprswitch gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse --sort-recent && hyprswitch dispatch -r

# use the if switching to the next window with the opening keypress is unwanted
#bind = alt, $key, exec, hyprswitch gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse
#bind = alt $reverse, $key, exec, hyprswitch gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse

Pressing alt+tab opens the gui AND switches to the next window. If tou have 2 windows and press alt+tab +tab you focus the original window.

H3rmt commented 3 days ago

&& hyprswitch dispatch is executed if you press keys when opening hyprswitch to send commands to the daemon

zonk911 commented 3 days ago

Maybe i get something wrong, but i think the error message is still a thing which should not happen i think, but to confirm the behavior i recorded my screen, hope this works and helps.

recording.tar.gz

Edit: uploaded video as tar.gz, i was able to play it with vlc. Somehow the online player didn't wanted to.

H3rmt commented 3 days ago

could you run the hyrswitch -vvv gui ... command from a terminal to see the client output?

zonk911 commented 3 days ago
hyprswitch -vvv gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=mod=grave && hyprswitch dispatch 
TRACE Hyprland Version { branch: "", commit: "500d2a3580388afc8b620b0a3624147faa34f98b", dirty: false, commit_message: "[gha] Nix: update inputs", commit_date: "Mon Nov 18 14:29:06 2024", tag: "v0.45.1", commits: "5448", build_aquamarine: "0.5.0", flags: ["debug"] }
INFO Starting Hyprswitch (3.1.1) on Hyprland v0.45.1
DEBUG Checking if daemon is running
INFO initialising daemon
TRACE Sending init command Transfer { transfer: Init(Config { ignore_monitors: false, ignore_workspaces: false, sort_recent: false, filter_current_workspace: false, filter_current_monitor: false, filter_same_class: false, include_special_workspaces: false, switch_type: Client }, GuiConfig { max_switch_offset: 5, mod_key: AltL, key: "tab", close: ModKeyRelease, reverse_key: Mod("grave"), hide_active_window_border: false }), version: "3.1.1" }

no error message nothing, but i cant switch with the keys through the list, clicking with mouse works

let me search all of my config, maybe there is still something referenced somewhere which causes this issues

H3rmt commented 3 days ago

can you store the output of the keybind command in a file and upload it, there I could see what causes the notification.

H3rmt commented 3 days ago

This notification should only show if you didnt restart the daemon after the 3.0.0 update.

The daemon pre 3.0.0 didnt check versions and didnt show any notification when a newer client tried to connect and fail.

zonk911 commented 3 days ago

ok, i found a second exec-once hyprswitch... i removed it, restarted, but still i get the same errors, let me see if i can get the logs from the keybinds

zonk911 commented 3 days ago

can you store the output of the keybind command in a file and upload it, there I could see what causes the notification.

You need to help me how i get the logs you want right now. There is a section in the logs i already provided which lists the binds of the current instance. See:

TRACE keyword_list: 
TRACE submap = hyprswitch-3.1.1-373864045
TRACE bind =  ,escape , exec, /usr/bin/hyprswitch close --kill
TRACE bind = alt ,escape , exec, /usr/bin/hyprswitch close --kill
TRACE bind = alt, tab, exec, /usr/bin/hyprswitch dispatch
TRACE bind = alt grave, tab, exec, /usr/bin/hyprswitch dispatch -r
TRACE bindrt = alt, alt_l, exec, /usr/bin/hyprswitch close
TRACE bindrt = alt grave, alt_l, exec, /usr/bin/hyprswitch close
TRACE bind = alt ,1, exec, /usr/bin/hyprswitch dispatch -o=1
TRACE bind = alt grave,1, exec, /usr/bin/hyprswitch dispatch -o=1 -r
TRACE bind = alt ,2, exec, /usr/bin/hyprswitch dispatch -o=2
TRACE bind = alt grave,2, exec, /usr/bin/hyprswitch dispatch -o=2 -r
TRACE bind = alt ,3, exec, /usr/bin/hyprswitch dispatch -o=3
TRACE bind = alt grave,3, exec, /usr/bin/hyprswitch dispatch -o=3 -r
TRACE bind = alt ,4, exec, /usr/bin/hyprswitch dispatch -o=4
TRACE bind = alt grave,4, exec, /usr/bin/hyprswitch dispatch -o=4 -r
TRACE bind = alt ,5, exec, /usr/bin/hyprswitch dispatch -o=5
TRACE bind = alt grave,5, exec, /usr/bin/hyprswitch dispatch -o=5 -r
TRACE submap = reset
TRACE keyword_list end

I quickly searched for it but didn't found it.

H3rmt commented 3 days ago

append 2> /tmp/test-1.log to the keybinds (add them to both the dispatch and gui command and dont forget to add -vvv to both the commands)

zonk911 commented 3 days ago
bind = alt, $key, exec, hyprswitch -vvv gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse 2> /tmp/gui1.log && hyprswitch dispatch 2> /tmp/dispatch1.log
bind = alt $reverse, $key, exec, hyprswitch -vvv gui --mod-key alt_l --key $key --close mod-key-release --reverse-key=mod=$reverse 2> /tmp/gui2.log && hyprswitch dispatch -r 2> /tmp/dispatch2.log

dispatch1.log gui1.log gui2.log

In gui2.log is an error.

Have a good night.

H3rmt commented 3 days ago

The link to dispatch1.log doesnt work, idk why: image

The second log contains an error, but to see where the error was caused i need to see the server log.

I will be available again tomorrow at 10:40 (UTC +01:00)

H3rmt commented 3 days ago

I think I know why the error occurs.

The daemon returns unsuccesfull for the gui command if the daemon already has been initialised.

I you remove both logs and only press alt + tab, release and check both logs, is there a gui2.log file?

If there is it means both bind commands got executed by the same key press, meaning they both tried to send a configure command which causes a error if the gui is opened

zonk911 commented 3 days ago

Yes there is a gui2.log, just pressed alt + tab, nothing else. I try to respond this evening again.

zonk911 commented 2 days ago

Do you need something else?

H3rmt commented 2 days ago

I don't know why but it seems init was triggered twice which caused the error. I published a new version which prevents the popup

zonk911 commented 2 days ago

All right, i installed the new version, restarted the system and the error message is gone. Thats already something. Then i disabled one of the binds, so that only one bind should be active and i still get the same behavior where i can not press multiple times the tab key, cause it is jumping back all the time. The gui log does not show an error and the dispatch log is empty. In 99% the errors are configuration issues. So i'll dig on my side if i can find something suspicious on my end and then i can let you know.

H3rmt commented 2 days ago

After analysing logs from the video it looks like every keybind is executed twice.

use hyprclt binds | grep hyprswitch to see the keybinds (ignore the keybinds with submaps)

zonk911 commented 2 days ago

hyprctl binds | grep hyprswitch | grep arg

arg: hyprswitch -vvv gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=mod=grave 2> /tmp/gui1.log && hyprswitch dispatch 2> /tmp/dispatch1.log
    arg: /usr/bin/hyprswitch close --kill
    arg: /usr/bin/hyprswitch close --kill
    arg: /usr/bin/hyprswitch dispatch
    arg: /usr/bin/hyprswitch dispatch -r
    arg: /usr/bin/hyprswitch close
    arg: /usr/bin/hyprswitch close
    arg: /usr/bin/hyprswitch dispatch -o=1
    arg: /usr/bin/hyprswitch dispatch -o=1 -r
    arg: /usr/bin/hyprswitch dispatch -o=2
    arg: /usr/bin/hyprswitch dispatch -o=2 -r
    arg: /usr/bin/hyprswitch dispatch -o=3
    arg: /usr/bin/hyprswitch dispatch -o=3 -r
    arg: /usr/bin/hyprswitch dispatch -o=4
    arg: /usr/bin/hyprswitch dispatch -o=4 -r
    arg: /usr/bin/hyprswitch dispatch -o=5
    arg: /usr/bin/hyprswitch dispatch -o=5 -r
H3rmt commented 2 days ago

can you add the -j flag and also show the bind

H3rmt commented 2 days ago
{
    "locked": false,
    "mouse": false,
    "release": false,
    "repeat": false,
    "non_consuming": false,
    "has_description": false,
    "modmask": 64,
    "submap": "",
    "key": "tab",
    "keycode": 0,
    "catch_all": false,
    "description": "",
    "dispatcher": "exec",
    "arg": "/usr/bin/hyprswitch gui --mod-key super_l --key tab --hide-active-window-border"
},
{
    "locked": false,
    "mouse": false,
    "release": false,
    "repeat": false,
    "non_consuming": false,
    "has_description": false,
    "modmask": 8,
    "submap": "",
    "key": "tab",
    "keycode": 0,
    "catch_all": false,
    "description": "",
    "dispatcher": "exec",
    "arg": "/usr/bin/hyprswitch gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=key=grave --switch-type=workspace --filter-current-monitor && /usr/bin/hyprswitch dispatch"
},
{
    "locked": false,
    "mouse": false,
    "release": false,
    "repeat": false,
    "non_consuming": false,
    "has_description": false,
    "modmask": 8,
    "submap": "",
    "key": "grave",
    "keycode": 0,
    "catch_all": false,
    "description": "",
    "dispatcher": "exec",
    "arg": "/usr/bin/hyprswitch gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=key=grave --switch-type=workspace --filter-current-monitor && /usr/bin/hyprswitch dispatch -r"
},
{
    "locked": false,
    "mouse": false,
    "release": false,
    "repeat": false,
    "non_consuming": false,
    "has_description": false,
    "modmask": 4,
    "submap": "",
    "key": "tab",
    "keycode": 0,
    "catch_all": false,
    "description": "",
    "dispatcher": "exec",
    "arg": "/usr/bin/hyprswitch simple -s"
},
{
    "locked": false,
    "mouse": false,
    "release": false,
    "repeat": false,
    "non_consuming": false,
    "has_description": false,
    "modmask": 4,
    "submap": "",
    "key": "grave",
    "keycode": 0,
    "catch_all": false,
    "description": "",
    "dispatcher": "exec",
    "arg": "/usr/bin/hyprswitch simple -s -r"
}

ignoring every entry with "submap": "hyprswitch-3.1.2-***", these 5 are the only binds, but I also use hyprswitch in 3 different ways.

Every entry with a submap gets dynamically generated and applied when the gui is opened. (It would be an idea to not regenerate the same keymap all the time, but different mod and open keys require different submaps)

zonk911 commented 2 days ago

interesting, only one entry then hyprctl binds -j | grep hyprswitch

"arg": "hyprswitch -vvv gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=mod=grave 2> /tmp/gui1.log && hyprswitch dispatch 2> /tmp/dispatch1.log"

I checked without grep and there are only other entries.

hyprctl binds -j | grep arg

"arg": "kitty"
    "arg": ""
    "arg": "nautilus"
    "arg": ""
    "arg": ""
    "arg": "rofi -show combi -modes \"window,run,ssh,drun,keys\" combi-modes \"window,run,ssh,drun,keys\""
    "arg": ""
    "arg": ""
    "arg": "~/.config/ml4w/settings/browser.sh j Opens the browser"
    "arg": "~/.config/ml4w/scripts/reload-waybar.sh"
    "arg": "~/.config/ml4w/scripts/reload-hyprpaper.sh"
    "arg": "l"
    "arg": "d"
    "arg": "u"
    "arg": "r"
    "arg": "1"
    "arg": "2"
    "arg": "3"
    "arg": "4"
    "arg": "5"
    "arg": "6"
    "arg": "7"
    "arg": "8"
    "arg": "9"
    "arg": "10"
    "arg": "1"
    "arg": "2"
    "arg": "3"
    "arg": "4"
    "arg": "5"
    "arg": "6"
    "arg": "7"
    "arg": "8"
    "arg": "9"
    "arg": "10"
    "arg": "e+1"
    "arg": "e-1"
    "arg": "movewindow"
    "arg": "resizewindow"
    "arg": "brightnessctl s +8%"
    "arg": "brightnessctl s 8%-"
    "arg": "pamixer -i 8"
    "arg": "pamixer -d 8"
    "arg": "pamixer --default-source -m"
    "arg": "pamixer -t"
    "arg": "playerctl play-pause"
    "arg": "playerctl play-pause"
    "arg": "playerctl next"
    "arg": "playerctl previous"
    "arg": "hyprshot -m window"
    "arg": "hyprshot -m region"
    "arg": "hyprshot -m window"
    "arg": "hyprlock"
    "arg": "swaync-client -t"
    "arg": "hyprswitch -vvv gui --mod-key alt_l --key tab --close mod-key-release --reverse-key=mod=grave 2> /tmp/gui1.log && hyprswitch dispatch 2> /tmp/dispatch1.log"

The duplicated 1-10 is for movetoworkspace and workspace selection. The empty ones are also ok, i checked it.

zonk911 commented 2 days ago

my current setup has just one bind for hyprswitch, all other binds working as expected

H3rmt commented 2 days ago

I am still confused why init and all dispatch commands are called twice...