Add Hyprland stuff

This commit is contained in:
Tobias Manske 2023-11-27 23:31:36 +01:00
parent 06b642ae28
commit 5017ee7099
Signed by: tobias
GPG Key ID: 9164B527694A0709
9 changed files with 143 additions and 123 deletions

View File

@ -24,7 +24,7 @@ network_print() {
signal=$(nmcli -t -f in-use,signal device wifi list ifname "$device" | grep "\*" | cut -d ':' -f 2) signal=$(nmcli -t -f in-use,signal device wifi list ifname "$device" | grep "\*" | cut -d ':' -f 2)
if [ "$signal" -lt 40 ]; then if [ "$signal" -lt 40 ]; then
description="$description - %{F#f9cc18}$signal%%{F-}" description="$description - $signal"
fi fi
elif [ "$type" = "802-3-ethernet" ]; then elif [ "$type" = "802-3-ethernet" ]; then
icon="" icon=""
@ -53,9 +53,9 @@ network_print() {
fi fi
if [ $counter -gt 0 ]; then if [ $counter -gt 0 ]; then
printf " %s %s" "$icon" "$description" printf "%s %s" "$icon" "$description"
else else
printf "%s %s" "$icon" "$description" printf "%s %s" "$icon" "$description"
fi fi
counter=$((counter + 1)) counter=$((counter + 1))

View File

@ -14,19 +14,23 @@ exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CUR
# Execute your favorite apps at launch # Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox # exec-once = waybar & hyprpaper & firefox
exec-once = battery_status &
exec-once = swayidle & exec-once = swayidle &
exec-once = xiccd & exec-once = xiccd &
exec-once = dunst & exec-once = dunst &
exec-once = ibus-daemon -drxR & exec-once = ibus-daemon -drxR &
exec-once = sleep 3 && kanshi & exec-once = sleep 3 && kanshi &
exec-once = bash ~/.config/hypr/scripts/launch_waybar.sh exec-once = bash ~/.config/hypr/scripts/launch_waybar.sh &
exec-once = easyeffects --gapplication-service & exec-once = easyeffects --gapplication-service &
exec-once = lxqt-policykit-agent & exec-once = lxqt-policykit-agent &
exec-once = thunar --daemon & exec-once = thunar --daemon &
exec-once = copyq --start-server
exec-once = env QT_QPA_PLATFORM=xcb /usr/lib/kdeconnectd exec-once = env QT_QPA_PLATFORM=xcb /usr/lib/kdeconnectd &
exec-once = env QT_QPA_PLATFORM=xcb kdeconnect-indicator exec-once = env QT_QPA_PLATFORM=xcb kdeconnect-indicator &
monitor = eDP-1,pref,auto,auto
# On reload: # On reload:
exec = pkill -1 kanshi exec = pkill -1 kanshi
@ -124,6 +128,12 @@ misc {
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = float,class:^(thunderbird)$,title:.*Reminders?
windowrulev2 = workspace, 4,title:^(Spotify)$
windowrulev2 = workspace, 4,class:^(org.keepassxc.KeepassXC)$
windowrulev2 = workspace, 5,title:^(Discord).*$
windowrulev2 = workspace, 8,class:^(thunderbird)$
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
@ -132,6 +142,7 @@ $mainMod = SUPER
# bind = $mainMod, Q, exec, kitty # bind = $mainMod, Q, exec, kitty
bind = $mainMod SHIFT, Q, killactive, bind = $mainMod SHIFT, Q, killactive,
bind = $mainMod, RETURN, exec, alacritty bind = $mainMod, RETURN, exec, alacritty
bind = $mainMod, E, exec, thunar
bind = $mainMod CONTROL, L, exec, loginctl lock-session self bind = $mainMod CONTROL, L, exec, loginctl lock-session self
bindr = $mainMod, D, exec, dunstctl context bindr = $mainMod, D, exec, dunstctl context
bind = $mainMod, F, fullscreen bind = $mainMod, F, fullscreen
@ -141,7 +152,7 @@ binde = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +100
binde = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -100 binde = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -100
binde = SHIFT, XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +1000 binde = SHIFT, XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +1000
binde = SHIFT, XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -1000 binde = SHIFT, XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -1000
bind = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle bindr = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
# Microphone control # Microphone control
bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle bind = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle
@ -152,7 +163,6 @@ binde = , XF86MonBrightnessUp, exec, brightnessctl s +2%
binde = , XF86MonBrightnessDown, exec, brightnessctl s 2%- binde = , XF86MonBrightnessDown, exec, brightnessctl s 2%-
binde = SHIFT , XF86MonBrightnessUp, exec, brightnessctl s +10% binde = SHIFT , XF86MonBrightnessUp, exec, brightnessctl s +10%
binde = SHIFT , XF86MonBrightnessDown, exec, brightnessctl s 10%- binde = SHIFT , XF86MonBrightnessDown, exec, brightnessctl s 10%-
bind = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
# Flameshot # Flameshot
bindr = CONTROL SHIFT, Print, exec, ~/.config/hypr/scripts/screenshot.sh bindr = CONTROL SHIFT, Print, exec, ~/.config/hypr/scripts/screenshot.sh
@ -170,7 +180,7 @@ bind = ALT, SPACE, exec, rofi -show drun
bind = $mainMod, TAB, exec, rofi -show window bind = $mainMod, TAB, exec, rofi -show window
bind = $mainMod SHIFT, N, exec, networkmanager_dmenu --rofi -i bind = $mainMod SHIFT, N, exec, networkmanager_dmenu --rofi -i
bind = $mainMod SHIFT, B, exec, rofi-bluetooth bind = $mainMod SHIFT, B, exec, rofi-bluetooth
bind = $mainMod , E, exec, rofimoji --typer wtype bind = $mainMod SHIFT , E, exec, rofimoji --typer wtype
bind = $mainMod CONTROL, SPACE, togglefloating, bind = $mainMod CONTROL, SPACE, togglefloating,
bind = $mainMod, SPACE, layoutmsg, orientationnext bind = $mainMod, SPACE, layoutmsg, orientationnext
@ -214,8 +224,8 @@ bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10 bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll # Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_down, workspace, m+1
bind = $mainMod, mouse_up, workspace, e-1 bind = $mainMod, mouse_up, workspace, m-1
# Move/resize windows with mainMod + LMB/RMB and dragging # Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:272, movewindow

View File

@ -3,9 +3,16 @@
getDisplay () { getDisplay () {
local DESK local DESK
# DOCK
DESK="$(~/.config/hypr/scripts/displaybyname.sh Samsung Electric Company S34J55x H4LT100404)" DESK="$(~/.config/hypr/scripts/displaybyname.sh Samsung Electric Company S34J55x H4LT100404)"
[[ -n "$DESK" ]] && echo $DESK && return [[ -n "$DESK" ]] && echo $DESK && return
# FSI
DESK="$(~/.config/hypr/scripts/displaybyname.sh LG Electronics 24EB23 609NTFAF4483)"
[[ -n "$DESK" ]] && echo $DESK && return
# Technofabrik
DESK="$(~/.config/hypr/scripts/displaybyname.sh Dell Inc. DELL U2713HM GK0KD27S476L)"
[[ -n "$DESK" ]] && echo $DESK && return
# Fallback
echo "eDP-1" echo "eDP-1"
} }
@ -17,4 +24,4 @@ export PRIMARY_DISPLAY
envsubst < ~/.config/waybar/config > /tmp/waybar envsubst < ~/.config/waybar/config > /tmp/waybar
pkill waybar pkill waybar
waybar -c /tmp/waybar &! waybar -c /tmp/waybar $@ &!

33
hyprland/scripts/workspaces.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
mapfile -t MONITORS < <(hyprctl monitors -j | yq -r '. | sort_by(.x) | .[].name')
mapfile -t WORKSPACES < <(hyprctl workspaces -j | yq -r '.[].name')
function docked() {
if [ ! ${#MONITORS[@]} -eq 3 ]; then
echo "Not the right amount of displays"
exit 1
fi
echo "Assume Docked at home."
for i in "${!WORKSPACES[@]}"; do
# Move the workspace to the correct monitor
w=${WORKSPACES[$i]}
case $w in
4|8|9)
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[0]}"
;;
5|6)
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[2]}"
;;
*)
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[1]}"
;;
esac
done
}
if [ "$1" = "docked" ]; then
docked
fi

View File

@ -8,4 +8,17 @@ profile Dock {
exec systemctl --user start gammastep.service exec systemctl --user start gammastep.service
exec rfkill block wifi exec rfkill block wifi
exec bash ~/.config/hypr/scripts/launch_waybar.sh exec bash ~/.config/hypr/scripts/launch_waybar.sh
exec bash ~/.config/hypr/scripts/workspaces.sh docked
}
profile Dock-Fallback {
output "BNQ BenQ GL2450H ACB00126019" enable mode 1920x1080 position 0,0 transform 270 scale 1
output "BNQ BenQ GL2450H X4F00171019" enable mode 1920x1080 position 4520,0 transform normal scale 1
output "Samsung Electric Company S34J55x H4LT100404" enable mode 3440x1440 position 1080,0 transform normal scale 1
exec ~/.config/hypr/scripts/transformbyname.sh "BNQ BenQ GL2450H ACB00126019" 1
exec ~/.config/hypr/scripts/transformbyname.sh "BNQ BenQ GL2450H X4F00171019" 3
exec systemctl --user start gammastep.service
exec rfkill block wifi
exec bash ~/.config/hypr/scripts/launch_waybar.sh
exec bash ~/.config/hypr/scripts/workspaces.sh docked
} }

View File

@ -7,11 +7,13 @@
"spacing": 4, // Gaps between modules (4px) "spacing": 4, // Gaps between modules (4px)
"output": "${PRIMARY_DISPLAY}", "output": "${PRIMARY_DISPLAY}",
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["wlr/workspaces", "hyprland/window"], "modules-left": ["hyprland/workspaces", "hyprland/window"],
"modules-center": ["custom/inhibit", "idle_inhibitor", "custom/dunst"], "modules-center": ["custom/inhibit", "idle_inhibitor", "custom/dunst"],
"modules-right": ["hyprland/submap", "custom/wifionice", "custom/spotify", "pulseaudio", "custom/network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"], "modules-right": ["hyprland/submap", "custom/wifionice", "custom/spotify", "pulseaudio", "custom/network", "cpu", "memory", "temperature", "backlight", "battery", "clock", "tray"],
// Modules configuration // Modules configuration
"wlr/workspaces": { "hyprland/workspaces": {
"format-alt": "{name}",
"format-alt-click": "click-middle",
"disable-scroll": false, "disable-scroll": false,
"sort-by-number": true, "sort-by-number": true,
"all-outputs": true, "all-outputs": true,
@ -28,24 +30,24 @@
"default": "" "default": ""
} }
}, },
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"custom/spotify": { "custom/spotify": {
"format-alt": "{status_icon} {title}",
"format-alt-click": "click-middle",
"exec": "/usr/bin/python3 ~/.config/waybar/scripts/mediaplayer.py --player spotify", "exec": "/usr/bin/python3 ~/.config/waybar/scripts/mediaplayer.py --player spotify",
"format": "{} ", "format": "{status_icon} {artist} - {title}",
"return-type": "json", "return-type": "json",
"escape": true, "escape": true,
"on-click": "playerctl play-pause", "on-click": "playerctl play-pause",
"on-scroll-up": "playerctl next", "on-scroll-up": "playerctl next",
"on-scroll-down": "playerctl previous" "on-scroll-down": "playerctl previous"
}, },
"custom/debug": {
"format": "{}",
"exec": "~/test.sh",
"return-type": "json",
"escape": true,
"interval": 3
},
"custom/inhibit": { "custom/inhibit": {
"format": "☕", "format": "☕",
"on-click": "systemd-inhibit --what=handle-lid-switch --who=waybar --why='Inhibiting suspend' --mode=block sleep 120 & notify-send 'Inhibiting suspend' 'Waybar will prevent the system from suspending for 2 minutes'" "on-click": "systemd-inhibit --what=handle-lid-switch --who=waybar --why='Inhibiting suspend' --mode=block sleep 120 & notify-send 'Inhibiting suspend' 'Waybar will prevent the system from suspending for 2 minutes'"
@ -59,6 +61,8 @@
"restart-interval": 1 "restart-interval": 1
}, },
"custom/wifionice": { "custom/wifionice": {
"format-alt": "{:.2}", // only show train :D
"format-alt-click": "click-middle",
"exec": "~/.config/waybar/scripts/wifionice.sh", "exec": "~/.config/waybar/scripts/wifionice.sh",
"escape": true "escape": true
}, },
@ -112,9 +116,6 @@
// "format-full": "", // "format-full": "",
"format-icons": ["", "", "", "", ""] "format-icons": ["", "", "", "", ""]
}, },
"battery#bat2": {
"bat": "BAT2"
},
"custom/network": { "custom/network": {
"format": "{}", "format": "{}",
"max-length": 40, "max-length": 40,
@ -127,30 +128,19 @@
"format-bluetooth": "{volume}% {icon} {format_source}", "format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}", "format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}", "format-muted": " {format_source}",
"format-source": "{volume}% ", "format-source": "",
"format-source-muted": "", "format-source-muted": "",
"ignored-sinks": [ "Easy Effects Sink" ],
"format-icons": { "format-icons": {
"headphone": "", "headphone": "",
"hands-free": "", "hands-free": "",
"headset": "", "headset": "",
"phone": "", "phone": "",
"portable": "", "portable": "",
"car": "", "car": "",
"default": ["", "", ""] "default": ["", "", ""]
}, },
"on-click": "pavucontrol" "on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
} }
} }

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
readonly ENABLED='' readonly ENABLED=''
readonly DISABLED=' ' readonly DISABLED='\uf1f6' # nf-fa-bell_slash
dbus-monitor path='/org/freedesktop/Notifications',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged' --profile | dbus-monitor path='/org/freedesktop/Notifications',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged' --profile |
while read -r _; do while read -r _; do
PAUSED="$(dunstctl is-paused)" PAUSED="$(dunstctl is-paused)"

View File

@ -61,16 +61,6 @@ class PlayerManager:
def get_players(self) -> List[Player]: def get_players(self) -> List[Player]:
return self.manager.props.players return self.manager.props.players
def write_output(self, text, player):
logger.debug(f"Writing output: {text}")
output = {"text": text,
"class": "custom-" + player.props.player_name,
"alt": player.props.player_name}
sys.stdout.write(json.dumps(output) + "\n")
sys.stdout.flush()
def clear_output(self): def clear_output(self):
sys.stdout.write("\n") sys.stdout.write("\n")
sys.stdout.flush() sys.stdout.flush()
@ -107,27 +97,24 @@ class PlayerManager:
def on_metadata_changed(self, player, metadata, _=None): def on_metadata_changed(self, player, metadata, _=None):
logger.debug(f"Metadata changed for player {player.props.player_name}") logger.debug(f"Metadata changed for player {player.props.player_name}")
player_name = player.props.player_name data = {
artist = player.get_artist() "player_name": player.props.player_name,
title = player.get_title() "player_icon": "" if player.props.player_name == "spotify" else "",
"artist": player.get_artist(),
track_info = "" "title": player.get_title(),
if player_name == "spotify" and "mpris:trackid" in metadata.keys() and ":ad:" in player.props.metadata["mpris:trackid"]: "status": player.props.status,
track_info = "Advertisement" "status_icon": "" if player.props.status == "Paused" else "",
elif artist is not None and title is not None: "class": [
track_info = f"{artist} - {title}" player.props.player_name.lower(),
else: player.props.status.lower()
track_info = title ],
"text": f"{player.get_artist()} - {player.get_title()}",
if track_info: }
if player.props.status == "Playing":
track_info = "" + track_info
else:
track_info = "" + track_info
# only print output if no other player is playing # only print output if no other player is playing
current_playing = self.get_first_playing_player() current_playing = self.get_first_playing_player()
if current_playing is None or current_playing.props.player_name == player.props.player_name: if current_playing is None or current_playing.props.player_name == player.props.player_name:
self.write_output(track_info, player) sys.stdout.write(json.dumps(data) + "\n")
sys.stdout.flush()
else: else:
logger.debug(f"Other player {current_playing.props.player_name} is playing, skipping") logger.debug(f"Other player {current_playing.props.player_name} is playing, skipping")

View File

@ -19,15 +19,6 @@ window#waybar.hidden {
opacity: 0.2; opacity: 0.2;
} }
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite { window#waybar.termite {
background-color: #3F3F3F; background-color: #3F3F3F;
} }
@ -54,19 +45,16 @@ button:hover {
#workspaces button { #workspaces button {
padding: 0 5px; padding: 0 5px;
background-color: transparent; background-color: transparent;
color: #ffffff; color: @text;
} }
#submap { #submap {
padding: 0 10px; padding: 0 10px;
margin: 0 4px; margin: 0 4px;
background-color: @peach; background-color: @peach;
color: black; color: @base;
} }
#dunst {
}
#workspaces button:hover { #workspaces button:hover {
background: alpha(@overlay0, 0.2); background: alpha(@overlay0, 0.2);
@ -107,7 +95,7 @@ button:hover {
#scratchpad, #scratchpad,
#mpd { #mpd {
padding: 0 10px; padding: 0 10px;
color: #ffffff; color: @text;
border-bottom: 3px solid alpha(@crust, 0.5); border-bottom: 3px solid alpha(@crust, 0.5);
} }
#window, #window,
@ -125,30 +113,39 @@ button:hover {
margin-right: 0; margin-right: 0;
} }
#clock { .modules-center {
background-color: #64727D; background-color: @surface0;
}
#memory,
#clock,
#memory,
#disk,
#idle_inhibitor.activated {
background-color: @lavender;
color: @base;
} }
#battery { #battery {
background-color: @yellow; background-color: @yellow;
color: black; color: @base;
} }
#battery.charging, #battery.plugged { #battery.charging, #battery.plugged {
color: black; color: @base;
background-color: @green; background-color: @green;
} }
@keyframes blink { @keyframes blink {
to { to {
background-color: @yellow; background-color: @yellow;
color: black; color: @base;
} }
} }
#battery.critical:not(.charging) { #battery.critical:not(.charging) {
background-color: @red; background-color: @red;
color: black; color: @base;
animation-name: blink; animation-name: blink;
animation-duration: 0.5s; animation-duration: 0.5s;
animation-timing-function: linear; animation-timing-function: linear;
@ -158,25 +155,18 @@ button:hover {
#custom-wifionice { #custom-wifionice {
background-color: @red; background-color: @red;
color: black; color: @base;
} }
label:focus { label:focus {
background-color: black; background-color: @base;
} }
#cpu { #cpu {
background-color: @green; background-color: @green;
color: black; color: @base;
} }
#memory {
background-color: @lavender;
}
#disk {
background-color: @lavender;
}
#backlight { #backlight {
background-color: @overlay1; background-color: @overlay1;
@ -184,7 +174,7 @@ label:focus {
#custom-network { #custom-network {
background-color: @sky; background-color: @sky;
color: black; color: @base;
} }
#network.disconnected { #network.disconnected {
@ -193,12 +183,13 @@ label:focus {
#pulseaudio { #pulseaudio {
background-color: @yellow; background-color: @yellow;
color: black; color: @base;
} }
#pulseaudio.muted { #custom-dunst.disabled,
background-color: @overlay2; #pulseaudio.source-muted {
color: @text; background-color: @red;
color: @base;
} }
#custom-media { #custom-media {
@ -208,15 +199,13 @@ label:focus {
} }
#custom-spotify { #custom-spotify {
padding: 0 10px;
margin: 0 4px;
background-color: @green; background-color: @green;
color: black; color: @base;
} }
#temperature { #temperature {
background-color: @peach; background-color: @peach;
color: black; color: @base;
} }
#temperature.critical { #temperature.critical {
@ -235,12 +224,3 @@ label:focus {
-gtk-icon-effect: highlight; -gtk-icon-effect: highlight;
background-color: @red; background-color: @red;
} }
#idle_inhibitor {
background-color: @base;
}
#idle_inhibitor.activated {
background-color: @lavender;
color: #2d3436;
}