-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Initial try on functions for sway/wayland #93
base: master
Are you sure you want to change the base?
Conversation
This looks like something I'll be happy to merge, thanks @zauster! At a glance, three comments come to mind:
|
Hey, I agree that it would be nicer to do the json parsing in elisp. But my |
I don't have |
Sure, here you go: |
Writing this using the PR - works beautifully! It does require $XDG_CURRENT_DESKTOP to be set which Sway does not do on its own. |
(let* ((json-string (emacs-everywhere--call "sh" "-c" "swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true)'")) | ||
(json-object (json-read-from-string json-string)) | ||
(window-id (number-to-string (cdr (assoc 'id json-object)))) | ||
(app-name (cdr (assoc 'app_id json-object))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using this branch I noticed that not all applications have an app_id
on my system, leading to a Wrong type argument: stringp, nil
in *Messages*
.
I think the ones running with Xwayland do not have one (Slack in my case). They have window_properties['class']
set though, so I could get them to work with this change:
(app-name (cdr (assoc 'app_id json-object))) | |
(app-name (cdr (assoc 'app_id json-object))) | |
(app-name (if app-name app-name (cdr (assoc 'class (cdr (assoc 'window_properties json-object)))))) |
Hey,
I have a basic implementation of the needed functions for sway/wayland that mostly works.
ydotoold
has to run to be able to use this code. It mainly uses the commands proposed by msin32 here: #50 (comment)What does not work:
(emacs-everywhere)
, modify that text and paste it back: nothing is pasted back into the input field(emacs-everywhere)
in the same input field does not always paste the text