Add automatic workspace renaming script
This commit is contained in:
@@ -160,27 +160,27 @@ input "1102:4619:DLL07A0:01_044E:120B" {
|
||||
# Workspaces:
|
||||
#
|
||||
# Switch to workspace
|
||||
bindsym $mod+ampersand workspace $w1
|
||||
bindsym $mod+eacute workspace $w2
|
||||
bindsym $mod+quotedbl workspace $w3
|
||||
bindsym $mod+apostrophe workspace $w4
|
||||
bindsym $mod+parenleft workspace $w5
|
||||
bindsym $mod+minus workspace $w6
|
||||
bindsym $mod+egrave workspace $w7
|
||||
bindsym $mod+underscore workspace $w8
|
||||
bindsym $mod+ccedilla workspace $w9
|
||||
bindsym $mod+agrave workspace $w0
|
||||
bindsym $mod+ampersand workspace number 1
|
||||
bindsym $mod+eacute workspace number 2
|
||||
bindsym $mod+quotedbl workspace number 3
|
||||
bindsym $mod+apostrophe workspace number 4
|
||||
bindsym $mod+parenleft workspace number 5
|
||||
bindsym $mod+minus workspace number 6
|
||||
bindsym $mod+egrave workspace number 7
|
||||
bindsym $mod+underscore workspace number 8
|
||||
bindsym $mod+ccedilla workspace number 9
|
||||
bindsym $mod+agrave workspace number 10
|
||||
# Move focused container to workspace
|
||||
bindsym $mod+Shift+ampersand move container to workspace $w1
|
||||
bindsym $mod+Shift+eacute move container to workspace $w2
|
||||
bindsym $mod+Shift+quotedbl move container to workspace $w3
|
||||
bindsym $mod+Shift+apostrophe move container to workspace $w4
|
||||
bindsym $mod+Shift+parenleft move container to workspace $w5
|
||||
bindsym $mod+Shift+minus move container to workspace $w6
|
||||
bindsym $mod+Shift+egrave move container to workspace $w7
|
||||
bindsym $mod+Shift+underscore move container to workspace $w8
|
||||
bindsym $mod+Shift+ccedilla move container to workspace $w9
|
||||
bindsym $mod+Shift+agrave move container to workspace $w0
|
||||
bindsym $mod+Shift+ampersand move container to workspace number 1
|
||||
bindsym $mod+Shift+eacute move container to workspace number 2
|
||||
bindsym $mod+Shift+quotedbl move container to workspace number 3
|
||||
bindsym $mod+Shift+apostrophe move container to workspace number 4
|
||||
bindsym $mod+Shift+parenleft move container to workspace number 5
|
||||
bindsym $mod+Shift+minus move container to workspace number 6
|
||||
bindsym $mod+Shift+egrave move container to workspace number 7
|
||||
bindsym $mod+Shift+underscore move container to workspace number 8
|
||||
bindsym $mod+Shift+ccedilla move container to workspace number 9
|
||||
bindsym $mod+Shift+agrave move container to workspace number 10
|
||||
# Note: workspaces can have any name you want, not just numbers.
|
||||
# We just use 1-10 as the default.
|
||||
bindsym $mod+Shift+equal move workspace to output right
|
||||
@@ -280,31 +280,32 @@ gaps inner 6
|
||||
include /etc/sway/config.d/*
|
||||
|
||||
# Assignments
|
||||
assign [class="discord"] workspace $w3
|
||||
assign [class="Spotify"] workspace $w3
|
||||
assign [class="discord"] workspace number 3
|
||||
assign [class="Spotify"] workspace number 3
|
||||
#for_window [class="Chromium"] opacity 0.9
|
||||
|
||||
exec redshift -O 4500 -m wayland
|
||||
exec megasync
|
||||
exec nm-applet --indicator
|
||||
exec ~/.config/sway/workspace-rename.sh
|
||||
|
||||
workspace $w1 output eDP-1
|
||||
workspace number 1 output eDP-1
|
||||
exec $term
|
||||
|
||||
workspace $w2 output eDP-1
|
||||
workspace number 2 output eDP-1
|
||||
|
||||
workspace $w3 output eDP-1
|
||||
workspace number 3 output eDP-1
|
||||
exec discord
|
||||
exec spotify
|
||||
|
||||
workspace $w4 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
workspace number 4 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
|
||||
workspace $w5 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
workspace number 5 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
|
||||
workspace $w6 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
workspace number 6 output "Dell Inc. DELL U2410 F525M0A1082L"
|
||||
|
||||
workspace $w7 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
workspace number 7 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
|
||||
workspace $w8 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
workspace number 8 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
|
||||
workspace $w9 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
workspace number 9 output "Dell Inc. DELL U2717D JXRPT83GAHKS"
|
||||
|
||||
36
.config/sway/workspace-rename.sh
Executable file
36
.config/sway/workspace-rename.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
workspace_num=-1
|
||||
workspace_name=""
|
||||
|
||||
swaymsg -t subscribe -m '[ "workspace", "window" ]' | while IFS= read -r event ; do
|
||||
if [ "$(jq -r '.change' <<< $event)" == 'focus' ] ; then
|
||||
if [ "$(jq -r '.container' <<< $event)" == 'null' ] ; then
|
||||
# Workspace
|
||||
workspace_num="$(jq -r '.current.num' <<< $event)"
|
||||
workspace_name="$(jq -r '.current.name' <<< $event)"
|
||||
elif [ workspace_num != -1 ] ; then
|
||||
# Window
|
||||
app_name="$(jq -r '.container.app_id' <<< $event)"
|
||||
if [ $app_name == 'null' ] ; then
|
||||
app_name="$(jq -r '.container.window_properties.instance' <<< $event)"
|
||||
fi
|
||||
|
||||
if [ "$app_name" == "kitty" ] ; then
|
||||
app_name=""
|
||||
elif [ "$app_name" == "chromium" ] ; then
|
||||
app_name=""
|
||||
elif [ "$app_name" == "discord" ] ; then
|
||||
app_name=""
|
||||
elif [ "$app_name" == "spotify" ] ; then
|
||||
app_name=""
|
||||
elif [ "$app_name" == "GEMOC Studio" ] ; then
|
||||
app_name=""
|
||||
fi
|
||||
|
||||
new_workspace_name="$workspace_num:$app_name"
|
||||
swaymsg rename workspace "$workspace_name" to "$new_workspace_name"
|
||||
workspace_name="$new_workspace_name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user