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
How to autostart applications the right way? #685
Comments
Why not use the |
Looks good. I didn't know about it. Thanks. Just for the sake of completeness, is it possible to spawn more than one application per group with this technique? |
On Sun, Jun 28, 2015 at 07:29:39AM -0700, Antoine Pinsard wrote:
Doesn't look like it, but I don't think it would be hard to add.
|
Yep, could be interesting to accept a list. |
My apologies for the necro bump but just in case there's another newbie out there who's crashing their qtile while trying to fire up auto-start commands, this worked for me: @hook.subscribe.startup_once
def autostart():
processes = [
['/usr/bin/setxkbmap', '-option', 'caps:swapescape'],
['feh', '--bg-scale', '/home/user/Pictures/wallpaper/archfoil.jpg'],
['blueman-applet'],
['nextcloud']
]
for p in processes:
subprocess.Popen(p) I had originally tried loading a script as per the Qtile manual but I'd either end up with a black screen or a loaded background + empty bar and nothing more. The mouse would move but the interface ends up completely broken. Here's the shell script I had attempted to use: #! /usr/bin/bash
/usr/bin/setxkbmap -option "caps:swapescape" &
feh --bg-scale ~/Pictures/wallpaper/archfoil.jpg &
blueman-applet &
nextcloud
|
On Sun, Dec 09, 2018 at 09:26:17AM -0800, trevDev(); wrote:
My apologies for the necro bump but just in case there's another newbie out there who's crashing their qtile while trying to fire up auto-start commands, this worked for me:
```python
@hook.subscribe.startup_once
def autostart():
processes = [
['/usr/bin/setxkbmap', '-option', '"caps:swapescape"']
Looks like you're missing a comma here,
['feh', '--bg-scale', '~/Pictures/wallpaper/archfoil.jpg'],
['blueman-applet'],
['nextcloud']
]
for p in processes:
subprocess.Popen(p)
```
I had originally tried loading a script as per the [Qtile manual](http://docs.qtile.org/en/latest/manual/config/hooks.html) but I'd either end up with a black screen or a loaded background + empty bar and nothing more. The mouse would move but the interface ends up completely broken. Here's the shell script I had attempted to use:
Probably it was because the startup_once() hook threw an exception and
crashed? We should maybe add a bare except around this hook so qtile
can keep booting if something bad does happen.
… ```bash
#! /usr/bin/bash
/usr/bin/setxkbmap -option "caps:swapescape" &
feh --bg-scale ~/Pictures/wallpaper/archfoil.jpg &
blueman-applet &
nextcloud
```
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#685 (comment)
|
On Sun, Dec 09, 2018 at 10:49:44AM -0700, Tycho Andersen wrote:
On Sun, Dec 09, 2018 at 09:26:17AM -0800, trevDev(); wrote:
> My apologies for the necro bump but just in case there's another newbie out there who's crashing their qtile while trying to fire up auto-start commands, this worked for me:
>
> ```python
> @hook.subscribe.startup_once
> def autostart():
> processes = [
> ['/usr/bin/setxkbmap', '-option', '"caps:swapescape"']
Looks like you're missing a comma here,
> ['feh', '--bg-scale', '~/Pictures/wallpaper/archfoil.jpg'],
> ['blueman-applet'],
> ['nextcloud']
> ]
>
> for p in processes:
> subprocess.Popen(p)
> ```
>
> I had originally tried loading a script as per the [Qtile manual](http://docs.qtile.org/en/latest/manual/config/hooks.html) but I'd either end up with a black screen or a loaded background + empty bar and nothing more. The mouse would move but the interface ends up completely broken. Here's the shell script I had attempted to use:
Probably it was because the startup_once() hook threw an exception and
crashed? We should maybe add a bare except around this hook so qtile
can keep booting if something bad does happen.
Oh, no, looks like hook.fire should do this for us, so I'm not sure
what was going on for you :(
… > ```bash
> #! /usr/bin/bash
>
> /usr/bin/setxkbmap -option "caps:swapescape" &
> feh --bg-scale ~/Pictures/wallpaper/archfoil.jpg &
> blueman-applet &
> nextcloud
>
> ```
>
> --
> You are receiving this because you commented.
> Reply to this email directly or view it on GitHub:
> #685 (comment)
|
Beg your pardon! My typos here were not in my actual config. I appreciate the sharp eyes. |
The above didn't work exactly. So if you are coming after 04-08-2023, the below should work:
# You don't have to use feh or any other third party thing to set your wallpaper.
# Qtile has inbuilt functionality for that.
# Set wallpaper = and wallpaper_mode inside your Screen() as shown below.
screens = [
Screen(
# This is the path including the file name for your wallpaper. And also set wallpaper_mode.
wallpaper="~/Pictures/wallpapers/humpback_whale_4k_5k_hd-1920x1080.jpg",
wallpaper_mode="fill",
bottom=bar.Bar(
[
widget.CurrentLayout(),
widget.GroupBox(),
widget.Prompt(),
widget.WindowName(),
],
24,
# border_width=[2, 0, 2, 0], # Draw top and bottom borders
# border_color=["ff00ff", "000000", "ff00ff", "000000"] # Borders are magenta
),
),
]
# You should've imported the below in your config.py
import os
import subprocess
# I wrote the hook below auto minimize = True line in the default config file.
# This doesn't matter. But if you are new and confused, now you know :)
@hook.subscribe.startup_once
def autostart():
home = os.expanduser('~/.config/qtile/autostart.sh')
subprocess.Popen([home]) autostart.sh #!/bin/sh
redshift-gtk &
firefox &
thunderbird & |
Thanks @unsungNovelty, that was handy. However there is a bug in your # Put this in in your config.py
from pathlib import Path
import subprocess
@hook.subscribe.startup_once
def autostart():
home = Path('~/.config/qtile/autostart.sh').expanduser()
subprocess.run(home) |
Hi, in order to get some application running on startup, I found this from the official doc and this from archlinux doc.
But none of them look elegant, nor provide a way to open application "X" on screen "N" or on group "Y".
So I tried to find other solutions to get this result. Some had no effect, some raised exceptions, but none worked.
Solution 1
Solution 2
Solution 3
autostart.qsh
config.py
Solution 4
autostart.qsh
autostart.sh
config.py
None of these solutions gave results.
So how to setup my workspace properly on startup? Thanks.
The text was updated successfully, but these errors were encountered: