1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

systemd: launch i3 and user programs with systemd

This commit is contained in:
Joe Groocock 2020-03-21 21:27:43 +00:00
parent d96ffc16ff
commit 757bd4c26d
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
34 changed files with 173 additions and 43 deletions

View File

@ -15,10 +15,3 @@ xrandr --dpi $(xrdb -query | grep -i xft.dpi | cut -d: -f2)
setxkbmap -option caps:none
xset r rate 200 18
# Merge system clipboards
if [ -n "$DISPLAY" ] && exists autocutsel && ! pidof autocutsel 1>/dev/null; then
autocutsel -fork
autocutsel -selection PRIMARY -fork
fi

View File

@ -107,7 +107,6 @@ client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-co
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color $bg-color
client.urgent $urgent-bg-color $urgent-bg-color $text-color $bg-color
exec_always --no-startup-id killall -q polybar; while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done; exec polybar -r i3bar
exec_always --no-startup-id feh --no-fehbg --no-xinerama --bg-fill $DOTFILES/lakesidesunrise.jpg
# Window rules
@ -130,7 +129,8 @@ focus_follows_mouse yes
# keybindings
bindsym $mod+Shift+j reload
bindsym $mod+c exec chromium
bindsym $mod+c exec systemd-run --user --scope --slice=chromium.slice --no-block -- chromium
bindsym $mod+b exec systemd-run --user --scope --slice=firefox.slice --no-block -- firefox
bindsym $mod+v exec "i3-sensible-terminal -e \\"$SHELL -c vim;$SHELL\\"
bindsym $mod+Ctrl+v exec "i3-sensible-terminal -r floating-term -e \\"$SHELL -c vim;$SHELL\\"
bindsym $mod+Return exec i3-sensible-terminal
@ -162,25 +162,4 @@ bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFA
bindsym XF86MonBrightnessUp exec xbacklight -inc 5 && pkill -RTMIN+12 i3blocks
bindsym XF86MonBrightnessDown exec xbacklight -dec 5 && pkill -RTMIN+12 i3blocks
# app launch shortcuts
exec --no-startup-id ~/.config/i3/disable-standby-fs.py
exec --no-startup-id feh --no-fehbg --no-xinerama --bg-fill ~/pictures/lakesidesunrise.jpg
exec --no-startup-id xautolock -time 5 -locker 'dm-tool switch-to-greeter' -nocloseout -nocloseerr
exec --no-startup-id xss-lock dm-tool switch-to-greeter
# startup programs
exec --no-startup-id nextcloud
exec --no-startup-id blueman-applet
exec --no-startup-id redshift
exec --no-startup-id xbindkeys
exec --no-startup-id solaar
exec --no-startup-id pullover
exec --no-startup-id mailnag
exec --no-startup-id picom -b --experimental-backends
exec --no-startup-id chromium --no-startup-window
exec --no-startup-id thunderbird
exec i3-msg 'workspace 1; exec sleep 2 && chromium'
exec i3-msg 'workspace 2; exec i3-sensible-terminal'
# vim:ft=i3

View File

@ -0,0 +1,10 @@
[Unit]
Description=autocutsel -selection primary
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/autocutsel -selection PRIMARY
[Install]
WantedBy=graphical-session.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=autocutsel
PartOf=graphical-session.target
[Service]
ExecStart=/usr/bin/autocutsel
[Install]
WantedBy=graphical-session.target

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/profile.service

View File

@ -0,0 +1,12 @@
[Unit]
Description=Bluetooth Applet
After=graphical-session.target bluetooth.service
Requires=graphical-session.target bluetooth.service
[Service]
Type=simple
ExecStart=/usr/bin/blueman-applet
Restart=on-failure
[Install]
WantedBy=desktop.target

View File

@ -0,0 +1 @@
/usr/lib/systemd/user/basic.target

View File

@ -0,0 +1 @@
/usr/lib/systemd/user/dunst.service

View File

@ -0,0 +1 @@
/usr/lib/systemd/user/redshift.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/blueman-applet.service

View File

@ -0,0 +1 @@
/usr/lib/systemd/user/dunst.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/nextcloud.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/picom.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/polybar@.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/solaar.service

View File

@ -0,0 +1 @@
/usr/lib/systemd/user/xdg-user-dirs-update.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/autocutsel-primary.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/autocutsel.service

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/i3.service

View File

@ -0,0 +1,14 @@
[Unit]
Description=i3 - an improved dynamic, tiling window manager
Requires=xorg.target
Before=graphical-session.target
After=profile.service xprofile.service xorg.target
[Service]
ExecStart=/usr/bin/i3
ExecReload=/bin/sh -c 'i3-msg restart; systemctl is-active --user -q picom && systemctl --user restart picom'
ExecStop=/bin/systemctl --user stop desktop.target
Restart=always
[Install]
WantedBy=graphical-session.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=Nextcloud Client
Requires=graphical-session.target
After=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/bin/nextcloud --background
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=desktop.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=A lightweight compositor for X11
Requires=graphical-session.target
After=graphical-session.target xorg.target
[Service]
Type=simple
ExecStart=/usr/bin/picom --experimental-backends --dbus
Restart=always
[Install]
WantedBy=desktop.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Polybar
Requires=graphical-session.target
After=graphical-session.target pulseaudio.socket
[Service]
Type=simple
ExecStart=/usr/bin/polybar --reload --log=warning %i
Restart=always
[Install]
WantedBy=desktop.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=Load profile environment into session
Before=graphical-session-pre.target
[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c '. $HOME/.config/dotfiles/.profile && systemctl --user import-environment'
[Install]
WantedBy=basic.target

View File

@ -1,5 +1,6 @@
[Unit]
Description=Lock X LightDM session before sleeping
Requires=graphical-session.target
Before=sleep.target
[Service]

View File

@ -1 +1 @@
../sleep-lock-lightdm.service
/home/frebib/.config/systemd/user/sleep-lock-lightdm.service

View File

@ -0,0 +1,13 @@
[Unit]
Description=Solaar Logitech status applet
Requires=graphical-session.target
After=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/bin/solaar --restart-on-wake-up -d
KillMode=process
Restart=on-failure
[Install]
WantedBy=desktop.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=XBindKeys
[Service]
ExecStart=/usr/bin/xautolock -time 1 -locker 'dm-tool switch-to-greeter' -detectsleep -resetsaver -secure
KillMode=process
Restart=on-failure
[Install]
WantedBy=graphical-session.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=XBindKeys
Requires=profile.service
After=profile.service
[Service]
ExecStart=/usr/bin/xbindkeys -n -f $XDG_CONFIG_HOME/X11/xbindkeysrc
KillMode=process
[Install]
WantedBy=graphical-session.target

View File

@ -0,0 +1,3 @@
[Unit]
Description=Graphical desktop environment
Requires=basic.target

View File

@ -0,0 +1 @@
/home/frebib/.config/systemd/user/xprofile.service

View File

@ -0,0 +1,13 @@
[Unit]
Description=Load Xorg configuration
PartOf=xorg.target
Requires=profile.service
After=xorg.target profile.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/bash -cx '. $XDG_CONFIG_HOME/X11/xprofile && systemctl --user import-environment'
[Install]
WantedBy=xorg.target

View File

@ -43,18 +43,14 @@ export PATH="${PATH}:/sbin:/usr/sbin:$DOTFILES/scripts:$GOPATH/bin"
exists() { which $@ 0<&- 1>/dev/null 2>/dev/null; }
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && exists dbus-launch; then
eval $(dbus-launch --sh-syntax --exit-with-session)
fi
# Execute this after updating dbus/systemd environment
# Source secret keys and values into environment
if [ -f "$XDG_CONFIG_HOME/secrets" ]; then
set -o allexport
source $XDG_CONFIG_HOME/secrets
set +o allexport
fi
# Start a dbus session daemon for programs that require it
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && exists dbus-launch; then
eval $(dbus-launch --sh-syntax --exit-with-session)
dbus-update-activation-environment --systemd \
DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY \
XDG_SEAT_PATH
fi

View File

@ -105,7 +105,9 @@ mcd(){ mkdir -p -- $@ && cd -- $@; }
randstr() { tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $1 | head -n 1; }
# System aliases
alias s="sudo systemctl"
alias sc="systemctl"
alias ssc="sudo systemctl"
alias scu="systemctl --user"
alias j=journalctl
alias ps='ps aux'
alias catn='tail -n +1 --'
@ -290,8 +292,8 @@ alias xinitrc="$EDITOR $XDG_CONFIG_HOME/X11/xinitrc"
alias xresources="$EDITOR $XDG_CONFIG_HOME/X11/xresources ; xrdb merge $XDG_CONFIG_HOME/X11/xresources"
alias sshc="$EDITOR ~/.ssh/config"
alias dotfiles="cd $DOTFILES"
alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config ; i3-msg restart"
alias polybarc="$EDITOR $XDG_CONFIG_HOME/polybar/config; killall -q polybar; while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done; exec polybar -r i3bar"
alias i3c="$EDITOR $XDG_CONFIG_HOME/i3/config; systemctl --user reload i3"
alias polybarc="$EDITOR $XDG_CONFIG_HOME/polybar/config; systemctl --user restart polybar@i3bar"
alias sf=screenfetch
alias nf=neofetch