-
Notifications
You must be signed in to change notification settings - Fork 414
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
BSPWM not recognizing Spotify #291
Comments
I was able to make a rule that works with Spotify by using |
I think this is a BSPWM issue and not a Spotify issue because Spotify's name is recognized by xprop. |
What's the output of xprop? |
|
What's the output of xlsw? |
|
Spotify sets its WM_CLASS too late. This property should exist when the map request is received. |
I get that Spotify should be the ones to fix this. But it worked before i updated bspwm (just did that today, haven't had time to create new configs before now). When it worked before, shouldn't it be fixable from bspwm's site? Any way to have a rule saying Spotify should spawn on a specific desktop? Some workaround? |
@Froziph A workaround for spotify is to get the _NET_WM_PID via xprop and then to grep the command name. An example for #!/bin/sh
id="${1?}" \
instance="$3" \
class="$2";
case "$class" in
(foo)
bar;;
("")
unset -v _NET_WM_PID;
. /dev/fd/0 2>/dev/null <<IN
: \"\${$(
xprop \
-id "$id" \
-notype \
-f _NET_WM_PID 32c '=$0' \
_NET_WM_PID;
)}\";
IN
case "$(ps -p "${_NET_WM_PID:?}" -o comm= 2>/dev/null)" in
(spotify)
echo desktop=^5;;
esac;;
esac; |
@d630 I'm facing the same problem, can you explain how to use your solution? |
Hey. I have come up with a much simpler solution in the meantime. Have a look at https://github.com/D630/bin/blob/master/bspwm-rules, https://github.com/D630/etc-bspwm/blob/master/etc/bspwm/bspwmrc, and https://github.com/baskerville/xdo |
Thanks a ton @d630 |
For posterity, this seems to be less spotify specific and more about electron apps in general? I have the same problem with slack from aur. Either way, @d630 's solution is a big help. 👍 |
Spotify will not follow rules set by bspc, because WM_CLASS is not set at the right time: baskerville/bspwm#291 (comment) As a workaround, navigate to the desired workspace before launching it.
Spotify will not follow rules set by bspc, because WM_CLASS is not set at the right time: baskerville/bspwm#291 (comment) As a workaround, navigate to the desired workspace before launching it.
external_rules.sh
|
Hey, @exynil @d630 Even I'm facing the same issue of not able to add a rule for spotify! You both have mentioned a Do I simply call the script in |
Hi @maniac-en, Sorry for my English. You need to use external rules in
You can look at my dotfiles |
Hey @exynil Thanks for your reply! Do you know what might be the issue? |
@maniac-en In fact, this is not a very good way (to rely on latency), but it turns out that data on the window class appears in the system some time after the program starts. I haven't found another way to quickly get the window class data yet. P.s. I have a poor level of English, I hope I didn't make any mistakes. |
@maniac-en |
Your English is completely fine, don't worry about that! I say almost because out of all the rules I supplied in spotify.sh , going to I tried changing the delay to 1, 1.5, 2, and even removing it, but no luck! Here's my bspwmrc which has the external rule for spotify! |
@maniac-en
when creating rules, you should rely on these names.
Hope this helps you! |
@exynil Thankyou so much for help! |
@maniac-en You’re welcome |
Alright so spotify has been a mother to work with the bspwm rules but I managed to find a workaround.
At the top of my bspwmrc I launch polybar then I have a few programs I want to start one of them being spotify: Then I put this command: This pretty much says "Take spotify and put it in the 6th workspace (Starting the count from 0, so really the 7th workspace) You can replace the 6 with whatever workspace you want spotify to go to.
I just used @d630 script he posted in 2016 and put this on my bspwmrc. And now my spotify goes to its assigned workspace at startup and if for whatever reason I close it during the session, if I reopen it it's going to to the assigned workspace. Phew... |
# [4.0.0](v3.0.0...v4.0.0) (2021-03-25) ### Bug Fixes * **arch:** remove opacity digits from xresources ([82fa1b0](82fa1b0)), closes [#dd292d3](https://github.com/eliasnorrby/dotfiles/issues/dd292d3) * **arch:** use correct package for xinput ([c63c076](c63c076)) * **bspwm:** update class used for tmux rule ([a4bd3a3](a4bd3a3)) * **fzf:** change binding for sort toggle ([2f0e0d0](2f0e0d0)) * **fzf:** do not use sudo for yay ([3bfab25](3bfab25)) * **fzf:** fix fuzzy args on MacOS ([5a8f1a1](5a8f1a1)) * **fzf:** source keybindings depending on os ([b3be4c1](b3be4c1)) * **gcloud:** eliminate subshells from env.zsh ([ae66e51](ae66e51)) * **git:** add main to gbpurge exclusion ([55d0b79](55d0b79)) * **intellij:** disable easymotion ([df4830f](df4830f)) * **intellij:** fix windowing on arch ([d497130](d497130)) * **java:** call java version alias separately ([c3b8549](c3b8549)) * **java:** move java aliases to macos block ([ba17866](ba17866)) * **provision:** add check to aur package install ([43efba3](43efba3)) * **provision:** add missing gcloud key root configs ([b5999b3](b5999b3)) * **provision:** fix mktemp spelling ([ac9d1e4](ac9d1e4)) * **provision:** remove do_defaults from setup-linux ([7a14498](7a14498)) * **provision:** set npm prefix in extra-packages ([a329819](a329819)) * **provision:** use coc-nvim's flags on extension install ([076affe](076affe)) * **provision:** use new cask upgrade command ([bc78304](bc78304)) * **scripts:** juggle find arguments ([66350b0](66350b0)) * **ssh:** add macos config file ([ab78e6e](ab78e6e)) * **tmux:** remove load average symbol ([f498251](f498251)) * **vim:** update coc eslint config key ([0d55559](0d55559)) * **work:** patch vpn settings for macos ([8080b21](8080b21)) * **xkb:** add shebang to setup-keybindings.sh ([c2021c9](c2021c9)) * **xkb:** kill xcape before calling ([607cb94](607cb94)) ### Features * **alacritty:** add glyph offsets on arch ([a82c501](a82c501)) * **alacritty:** bind paste ([9b68142](9b68142)) * **alacritty:** create tmux_alacritty wrapper ([622c9f1](622c9f1)) * **alacritty:** make theme setter work on all platforms ([c0ade4a](c0ade4a)) * **alacritty:** make use of alacritty config imports ([6e1dc93](6e1dc93)), closes [#38](#38) * **alacritty:** use ~ for config imports ([31dad08](31dad08)), closes [#38](#38) * **alacritty:** use a brighter bright black ([0a09db3](0a09db3)) * **alacritty:** use mononoki font ([aa384ca](aa384ca)) * **arch:** add additional keyserver ([2d5e09c](2d5e09c)) * **arch:** add focus_or_run script ([eec2ca1](eec2ca1)) * **arch:** add Xresources ([68358be](68358be)) * **arch:** set mouse sensitivity with xinput ([c805c91](c805c91)) * **bspwm:** launch dunst on startup ([f0736d1](f0736d1)) * **bspwm:** open chrome on desktop 6 ([f1015f6](f1015f6)) * **bspwm:** set active color to cyan ([3e04baa](3e04baa)) * **cli:** conditionally link different boomrcs ([8a6c3b1](8a6c3b1)) * **dunst:** add topic config ([b6ce8de](b6ce8de)) * **dunst:** rewrite default config ([b7a8468](b7a8468)) * **feh:** create topic config ([6cfba4d](6cfba4d)) * **fzf:** add pf alias for fuzzy pacman search ([b91bb02](b91bb02)) * **fzf:** enlarge pacman preview window ([71f4043](71f4043)) * **fzf:** filter chromium's history ([941a8fe](941a8fe)) * **fzf:** remove file path completion binding ([1ca4f5c](1ca4f5c)) * **fzf:** source completion ([9afad20](9afad20)) * **picom:** add background blurring ([86a6a3d](86a6a3d)) * **picom:** add shadows ([36a78c7](36a78c7)) * **picom:** enable vsync ([7871c05](7871c05)) * **picom:** experiment with fading ([59a950a](59a950a)) * **picom:** run with --experimental-backends ([d6127a3](d6127a3)) * **picom:** slightly reduce alacritty transparency ([e3fac8a](e3fac8a)) * **picom:** use the glx backend ([5fa0c24](5fa0c24)) * **polybar:** hide polybar in bspwm fullscreen ([545e44a](545e44a)) * **polybar:** modify example config ([95f51db](95f51db)) * **polybar:** update module icons ([a6b999a](a6b999a)) * **provision:** add optional condition to links ([2c8f15f](2c8f15f)) * **provision:** add rename option to topic links ([742657a](742657a)) * **provision:** become for pacman ([4934760](4934760)) * **provision:** install ansible roles in post ([a8d9d8c](a8d9d8c)) * **provision:** install aur packages ([c9cae53](c9cae53)) * **rofi:** add topic config ([1fe4167](1fe4167)) * **rofi:** launch rofi with super + space ([5085388](5085388)) * **rofi:** use dank mono font ([7c06945](7c06945)) * **sxhkd:** focus or run alacritty ([e2e6d21](e2e6d21)) * **sxhkd:** focus or run chromium ([040ff9c](040ff9c)) * **sxhkd:** map hyper + {1-9} to tmux windows ([254af0f](254af0f)) * **tmux:** choose copy tool based on platform ([91a4d50](91a4d50)) * **vim:** make cursorline light blue ([d0560cb](d0560cb)) * **vim:** use unnamedplus for clipboard ([5cd5c30](5cd5c30)) * **vscode:** conditionally set vscode_home ([93cae5f](93cae5f)) * **xkb:** add topic config ([cfa6b7f](cfa6b7f)) * **xkb:** map right alt to hyper key (mod3) ([0c41084](0c41084)) * **zsh:** remove '/' from WORDCHARS ([4b95c63](4b95c63)) * add become key to topic config ([798738f](798738f)) * **alacritty:** use some transparency ([7e42ee5](7e42ee5)) * **arch:** add and autostart dropbox ([659dcd9](659dcd9)) * **arch:** add topic base/arch ([ae6be72](ae6be72)) * **arch:** add topic config ([e191329](e191329)) * **arch:** create wrapper script for spotify ([05faf26](05faf26)), closes [/github.com/baskerville/bspwm/issues/291#issuecomment-145329416](https://github.com//github.com/baskerville/bspwm/issues/291/issues/issuecomment-145329416) * **arch:** enable kafka topic ([c213e5d](c213e5d)) * **arch:** handle focus of withdrawn windows ([afe0962](afe0962)) * **arch:** improve focus_or_run.sh ([0546b90](0546b90)) * **arch:** make aur buider a system user ([ec28d99](ec28d99)) * **bspm:** remove example config defaults ([796b3c4](796b3c4)) * **bspwm:** add 1password desktop rule ([689eac8](689eac8)) * **bspwm:** add checks for dependencies ([47ed18e](47ed18e)) * **bspwm:** add desktop rule for slack ([2eed97a](2eed97a)) * **bspwm:** add intellij desktop rule ([0b0b33e](0b0b33e)) * **bspwm:** add topic config ([07f76be](07f76be)) * **bspwm:** add topic wm/bspwm ([f8a6c2b](f8a6c2b)) * **bspwm:** make use of multiple monitors ([f8126d4](f8126d4)) * **bspwm:** reduce window gap to 10 ([d66c0f5](d66c0f5)) * **bspwm:** update for triple monitor setup ([16d0cfd](16d0cfd)) * **bspwm:** update window rules ([d2a125b](d2a125b)) * **bspwmrc:** configure monitors with xrandr ([01b1ab2](01b1ab2)) * **dotnet:** add lang/dotnet topic ([4decabc](4decabc)) * **dunst:** only show notifications on main monitor ([9db7f7b](9db7f7b)) * **emacs:** set font based on _os ([c1fa2b0](c1fa2b0)) * **fzf:** add fuzzy argument selection ([ebd53b7](ebd53b7)) * **gcloud:** source path and completion ([4568545](4568545)) * **git:** add gl and glnr aliases ([1f83273](1f83273)) * **git:** add gprd function ([641cf78](641cf78)) * **git:** add grv alias ([801f574](801f574)) * **hammerspoon:** add rider app mapping ([72ecb57](72ecb57)) * **hammerspoon:** add umlauts to app mode ([b7c2c04](b7c2c04)) * **intellij:** add compile project mapping ([b654e0c](b654e0c)) * **intellij:** add go mapping for file outline ([bfcde52](bfcde52)) * **intellij:** add hide coverage mapping ([9d74f44](9d74f44)) * **intellij:** add keybinds for navigating changes ([22aae08](22aae08)) * **intellij:** add mapping to create class ([d5fdf21](d5fdf21)) * **intellij:** add mapping to insert semicolon ([bc0e519](bc0e519)) * **intellij:** add mappings for hippie completion ([b651f3f](b651f3f)) * **intellij:** default to no line numbers ([f925564](f925564)) * **intellij:** harmonize ]d / ]e mappings ([66ba046](66ba046)) * **intellij:** map double space to GotoFile ([dd77421](dd77421)) * **intellij:** refine line number toggles ([6adb51f](6adb51f)) * **intellij:** revamp window closing mappings ([c4272d3](c4272d3)) * **intellij:** sort sections alphabetically ([16acda6](16acda6)) * **intellij:** switch to intellij ultimate ([7136da5](7136da5)) * **intellij:** try to mimic unimpaired's ]<space> ([350c5be](350c5be)) * **java:** rework JAVA_HOME env ([6de7264](6de7264)) * **kubernetes:** add aliases.zsh ([c87e801](c87e801)) * **macos:** add balenaetcher ([c350b2e](c350b2e)) * **macos:** enable kafka topic ([19b6660](19b6660)) * **node:** add npm to pacman_packages ([9e643fe](9e643fe)) * **node:** create a dir for global npm packages ([e80888d](e80888d)) * **picom:** add topic config ([1073b6a](1073b6a)) * **picom:** launch picom on login ([ebbec14](ebbec14)) * **picom:** make emacs transparent ([a9280bd](a9280bd)) * **polybar:** add alsa module ([4a79612](4a79612)) * **polybar:** add suspend to power menu ([c1ccbd9](c1ccbd9)) * **polybar:** add topic config ([1371137](1371137)) * **polybar:** add topic panel/polybar ([b972739](b972739)) * **polybar:** add vpn modules ([ef3f6c7](ef3f6c7)) * **polybar:** blacklist num lock indicator ([1a8b444](1a8b444)) * **polybar:** hide the tray ([88fead9](88fead9)) * **polybar:** join vpn modules ([bbd34ad](bbd34ad)) * **polybar:** try to make tray behave ([83657d1](83657d1)) * **polybar:** use desktop %name% for labels ([cc48586](cc48586)) * **polybar:** use mononoki font ([14ab7a2](14ab7a2)) * **polybar:** use systemctl poweroff ([ff7634e](ff7634e)) * **provision:** add custom setup script for linux ([15230d6](15230d6)) * **provision:** add platform check to update-all ([6090cea](6090cea)) * **provision:** add support for pacman packages ([4538dfc](4538dfc)) * **provision:** check for executables in post-install ([1be0e93](1be0e93)) * **provision:** create ssh config dirs ([cd75749](cd75749)) * **provision:** ensure list of dirs exist ([80b82c8](80b82c8)) * **provision:** install coc extensions in post ([c3a4aa6](c3a4aa6)) * **provision:** make setup-linux executable ([d3ee543](d3ee543)) * **scripts:** add update-remote.sh ([80823a1](80823a1)) * **scripts:** add work to git changes dirs ([e4fc645](e4fc645)) * **shell:** remove newline from _os helper ([a031eab](a031eab)) * **ssh:** add topic config ([b57b658](b57b658)) * **ssh:** include configs in config.d ([10e6e1a](10e6e1a)) * **ssh:** remove lifetime of unlocked keys ([af79d33](af79d33)) * **ssh:** use keychain ([8ce01b6](8ce01b6)) * **sxhkd:** add 1password keybind ([46b64a1](46b64a1)) * **sxhkd:** add binding to launch konsole ([641c5e3](641c5e3)) * **sxhkd:** add intellij keybind ([42a2e19](42a2e19)) * **sxhkd:** add slack keybind ([c370db2](c370db2)) * **sxhkd:** add topic config ([f76c89b](f76c89b)) * **sxhkd:** add topic keyboard/sxhkd ([e8f6602](e8f6602)) * **sxhkd:** add wallpaper swap keybind ([5b391bf](5b391bf)) * **sxhkd:** launch emacs with hyper + s ([347d84d](347d84d)) * **sxhkd:** launch ranger with hyper + r ([b74fc27](b74fc27)) * **sxhkd:** launch spotify with hyper + u ([6dd0847](6dd0847)) * **sxhkd:** quit apps with super + q ([7ac3118](7ac3118)) * **sxhkd:** use super + p to pin window ([2c47aa1](2c47aa1)) * **tmux:** add binding to highlight last link ([d4de5ba](d4de5ba)) * **tmux:** add scratch and dotfiles bindings ([6906b40](6906b40)) * **tmux:** add session list to status and keybinds ([ff3518a](ff3518a)) * **tmux:** disable active pane highlighting ([46d2999](46d2999)) * **tmux:** do not use session id for switching ([e4ba48a](e4ba48a)) * **tmux:** move session prompt to keybind ([8668943](8668943)) * **tmux:** relocate status elements ([0477fe6](0477fe6)) * **tmux:** skip the initial rename session prompt ([8fdbf62](8fdbf62)) * **vim:** add coc-groovy to coc-extensions ([4a3d3a3](4a3d3a3)) * **vim:** add CursorColumn highlight ([b172cb0](b172cb0)) * **vim:** add keybind to search project for selection ([dc90052](dc90052)) * **vim:** add keybind to toggle diff of windows ([af16609](af16609)) * **vim:** add scrollbind toggle ([4142c57](4142c57)) * **vim:** add tabular plugin ([ef9bb8e](ef9bb8e)) * **vim:** add vlog alias ([a82daa6](a82daa6)) * **vim:** brighten fzf's border ([8f53e36](8f53e36)) * **vim:** disable double cmdheight ([b479208](b479208)) * **vim:** enable coc-explorer file icons ([300c608](300c608)) * **vim:** map leader , to :History ([856ef05](856ef05)) * **vim:** update project-wide search functions ([9cef954](9cef954)), closes [/github.com/junegunn/fzf/issues/1109#issuecomment-339983902](https://github.com//github.com/junegunn/fzf/issues/1109/issues/issuecomment-339983902) [/github.com/junegunn/fzf.vim/issues/346#issuecomment-288483704](https://github.com//github.com/junegunn/fzf.vim/issues/346/issues/issuecomment-288483704) * **vim:** use editorconfig for shfmt settings ([67f34a6](67f34a6)), closes [#32](#32) * **vim:** use standard tabline ([f0bf112](f0bf112)) * **work:** add base/work topic ([41adbdd](41adbdd)) * **work:** add vpn connection scripts ([a7d9c89](a7d9c89)) * **work:** add vpn_disconnect and provision sudo ([00ff1d0](00ff1d0)) * **zsh:** add chx and ns aliases ([5c754cb](5c754cb)) * **zsh:** add fuzzy ascii art font picker ([90525d6](90525d6)) * **zsh:** add sudoedit alias ([d74e781](d74e781)) * **zsh:** only attach to tmux on macos ([e38eaac](e38eaac)) * **zsh:** only use gls on macos ([2f5969a](2f5969a)) * **zsh:** remove . from WORDCHARS ([53ee31a](53ee31a)) * **zsh:** remove line numbers from fzf preview ([a4754c9](a4754c9)) * **zsh:** start ssh-agent on launch ([8181d45](8181d45)) * **zsh:** switch yq implementation on arch ([438f929](438f929)) * add linux.config.yml ([c891af2](c891af2)) * add pacman_packages to topics ([069ae0c](069ae0c)) * refactor!: rename root.config.yml ([c9cead7](c9cead7)) ### BREAKING CHANGES * Instead of a singular root.config.yml, use <os>.config.yml's. This will force an update to the CLI.
A principal motivacao aqui foi resolver o problema do aplicativo snap Spotify que nao responde a rules simples do bspwm. Principal referencia sobre o problema: baskerville/bspwm#291
A principal motivacao aqui foi resolver o problema do aplicativo snap Spotify que nao responde a rules simples do bspwm. Principal referencia sobre o problema: baskerville/bspwm#291
However, the bspwm rule to bind Spotify window class to av workspace doesn't work just yet. The main reason being that the spotify X window sets the WindowClass too late, making bspwm doesn't pick it up and assign it to the correct workspace. More info here: baskerville/bspwm#291
However, the bspwm rule to bind Spotify window class to av workspace doesn't work just yet. The main reason being that the spotify X window sets the WindowClass too late, making bspwm to not recognize it and assign it to the correct workspace. More info here: baskerville/bspwm#291
I can fully confirm @lyonelz96 's solution and @d630 's script still work till this day. @d630 's script lack focus and follow so when you open the window, it doesn't switch workspace. To add that feature, simply add echo desktop=^5 follow=on focus=on;; Instead of echo desktop=^5;; |
A little note to anyone struggling to make @d630's script work: do not forget to add execution permissions to the bspwm-rules file. I have been stuck on this for like an hour... 😏 |
My problem with external rules is that on every window launch the script is going to be executed, which seems much heavier on resources. I ended up writing a devilspie2 rule after taking a look at dasJ/spotifywm#8: -- Move spotify to the designated desktop
local spotify_desktop = 5
if (get_application_name() == "Untitled window" and get_window_name() == "Untitled window") then
if get_process_name() == "spotify" then set_window_workspace(spotify_desktop) end
end |
Neither of the two solutions offered by @d630 nor @exynil seem to work for me. Even copy-pasting d630 config files from his second reply. I have I also tried changing the desktop=5 to desktop=V, since I have them named like that, as pointed by exynil to @maniac-en. I am using Debian stable + spotify flatpak. Could it be because of being a flatpak? |
Hello @PolGZ . I checked my solution is still working. If you still haven't solved the problem. Send me your bspwmrc and bspwmrc_extarnal_rules.sh file. |
They have finally fixed this. The latest version of the Spotify client now sets everything on time. |
I'm trying to make a rule for Spotify, but it's not working. When I run 'bspc query -T', Spotify appears to have no name. Here's the output of bspc query -T:
Spotify is the line below XFontSel. It doesn't have a name, so I can't make a rule pertaining to it.
The text was updated successfully, but these errors were encountered: