merge bluish fork: switch display manager to greetd, overhaul installation scripts, update readme (#75)

* style(waybar): remove temperature module from style.css
* Remove temperature module from style.css. We aren't using the temperature module in the Waybar so we don't need css for it.

* feat: replace sddm with greetd
* Remove sddm and eos-sddm-theme from packages-repository.txt, add greetd and greetd-regreet
* Add directory in repo for Greetd configs
* Add executable bit to scripts so it doesn't have to be set post-install
* Create home_config directory for files to be deployed to user's home root (.gtkrc-2.0, .nanorc)
* Rework the user_commands.bash script with explanatory comments, debug echoes, rework some of the commands
* Update README.md to mention installing with user_commands.bash method, update display manager references from SDDM to Greetd

To do:
* Update sway-install.sh for new deployment routine
* Debug set_once.sh (do we need this? It currently isn't being used since nothing is setting it as executable)
* setup.sh > seems to be an old version of the install script. Remove?

* fix(readme): image URL

* fix(readme.md): re-upload images

* feat(readme.md): update installation instructions

Add an ordered list to the installation instructions to accompany the Welcome/install-file picture.

* style(regreet.toml): update comment for WLR_RENDERER_ALLOW_SOFTWARE variable

* feat(setup_sway_isomode.bash): add vm detection
* Detect vm with systemd-detect-virt
* Conditionally enable WLR_RENDERER_ALLOW_SOFTWARE in ReGreet config

* fix(regreet.toml): revert welcome message to default

* feat(xed.dconf): update xed setup routine
* Add new self-destructing setup script for applying xed.dconf
* xed_setup.sh will be deployed by Sway autostart config. Script applies config, sends a notification, removes script call in autostart config, and deletes itself.
* set_once.sh and the line which calls it in ~/.config/sway/config have been deleted. The script wasn't actually doing anything to begin with since it was not executable, but now all the stuff it was supposed to do is taken care of in other scripts.

* feat(sway-install.sh): update post-install setup script
Update sway-install.sh based on the new configuration layout. The script runs as root instead of calling sudo multiple times in the script, but restores ownership to the user's home directory deploying the configs (using logname to determine the username).

* fix(sway-install.sh): update relative paths, remove call to clone repo

* fix(README.md): correct URL for user_commands.bash installation method

* fix(packages-repository.txt): remove redundant bluez-utils entry
bluez-utils is already included in the default package list in a stock EndeavourOS install with no DE.

* feat(sway): incorporate 50-systemd-user.conf into autostart_applications
* XDG_CURRENT_DESKTOP=sway is already set by the greeter
* Importing environment variables for the user systemd service manager and updating the dbus environment with display variables can be set in the autostart config.

* feat: add pamixer, update multimedia keybindings
* Add `pamixer`, allowing the volume multimedia keys to be simplified
* Use `playerctl`'s `play-pause` command by default. Having separate bindings for "play" and "pause" is appropriate if "play" and "pause" are separate multimedia keys, but what is more common is for these to be the same key.

* style: move foot server startup to autostart_applications

* style: tidy up sway config, simplify code comments
Get the config organized and make it easier to read through.

* feat: replace wofi with fuzzel
Wofi still works, but there is a notice on their sourcehut page (https://hg.sr.ht/~scoopta/wofi) that it is not actively maintained anymore. Fuzzel is an alternative picker from the same dev as Foot terminal. It is fast, highly customizable, and low resource usage.

In addition to being used as an application launcher, Wofi was being used in a script for the power menu and in a window switcher script. Those scripts have been re-written to provide the same functionality, but using Fuzzel for the picker.

* Add Fuzzel to packages-repository.txt, remove Wofi
* Add fuzzel.ini, remove Wofi configs and scripts
* Add new Fuzzel scripts to ~/.config/sway/scripts
* Update Waybar config (change Wofi calls to Fuzzel calls)
* Update Wofi mentions in cheatsheet, keyhint script, and README

* feat: add local desktop files with NoDisplay=true
Add local desktop files with NoDisplay=true for default applications which have a desktop file, but are not intended to be started from the launcher. Rather, these are utilities or menus which are meant to be started from within another application. Adding the NoDisplay=true property will help declutter the launcher's menu.

The installation scripts have also been updated to accomodate these files during the config deployment routine.
This commit is contained in:
BluishHumility
2024-08-04 16:45:57 +00:00
committed by GitHub
parent 492c3820da
commit aa3802ae5c
62 changed files with 490 additions and 456 deletions

View File

@@ -1,6 +0,0 @@
export MOZ_ENABLE_WAYLAND=1
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_TYPE=wayland
export WLR_NO_HARDWARE_CURSORS=1
#export WLR_NO_HARDWARE_CURSORS=0
export WLR_RENDERER_ALLOW_SOFTWARE=1

95
.config/fuzzel/fuzzel.ini Normal file
View File

@@ -0,0 +1,95 @@
# output=<not set>
font=JetBrainsMono:size=14
dpi-aware=no
prompt=" "
# icon-theme=hicolor
# icons-enabled=yes
# fields=filename,name,generic
# password-character=*
# filter-desktop=no
# fuzzy=yes
# show-actions=no
terminal=footclient -e
# launch-prefix=<not set>
# list-executables-in-path=no
# anchor=center
lines=16
width=50
tabs=4
horizontal-pad=50
vertical-pad=18
inner-pad=10
image-size-ratio=.25
# line-height=<use font metrics>
# letter-spacing=0
# layer = top
exit-on-keyboard-focus-loss = no
[colors]
background=08052bdd
text=e3e3eaff
match=FFE57Fff
selection-match=FFE57Fff
selection=44475add
selection-text=FFFFFFff
border=6272A4ff
[border]
# width=1
# radius=10
[dmenu]
# mode=text # text|index
# exit-immediately-if-empty=no
[key-bindings]
# cancel=Escape Control+g
# execute=Return KP_Enter Control+y
# execute-or-next=Tab
# execute-input=Shift+Return Shift+KP_Enter
# cursor-left=Left Control+b
# cursor-left-word=Control+Left Mod1+b
# cursor-right=Right Control+f
# cursor-right-word=Control+Right Mod1+f
# cursor-home=Home Control+a
# cursor-end=End Control+e
# delete-prev=BackSpace
# delete-prev-word=Mod1+BackSpace Control+BackSpace
# delete-line-backward=Control+u
# delete-next=Delete KP_Delete Control+d
# delete-next-word=Mod1+d Control+Delete Control+KP_Delete
# delete-line-forward=Control+k
# prev=Up Control+p
# prev-with-wrap=ISO_Left_Tab
# prev-page=Page_Up KP_Page_Up
# next=Down Control+n
# next-with-wrap=none
# next-page=Page_Down KP_Page_Down
# custom-N: *dmenu mode only*. Like execute, but with a non-zero
# exit-code; custom-1 exits with code 10, custom-2 with 11, custom-3
# with 12, and so on.
# custom-1=Mod1+1
# custom-2=Mod1+2
# custom-3=Mod1+3
# custom-4=Mod1+4
# custom-5=Mod1+5
# custom-6=Mod1+6
# custom-7=Mod1+7
# custom-8=Mod1+8
# custom-9=Mod1+9
# custom-10=Mod1+0
# custom-11=Mod1+exclam
# custom-12=Mod1+at
# custom-13=Mod1+numbersign
# custom-14=Mod1+dollar
# custom-15=Mod1+percent
# custom-16=Mod1+dead_circumflex
# custom-17=Mod1+ampersand
# custom-18=Mod1+asterix
# custom-19=Mod1+parentleft

View File

@@ -29,7 +29,7 @@ MOD+Return
# kill focused window
MOD+q
# Application menu - wofi:
# Application menu - Fuzzel:
MOD+d
# Activities:

View File

@@ -1,6 +1,3 @@
# Initial Setup
exec ~/set_once.sh
# Config for sway
#
# Read `man 5 sway` for a complete reference.
@@ -8,6 +5,3 @@ exec ~/set_once.sh
#
# user config directory
include $HOME/.config/sway/config.d/*
# only enable this if every app you use is compatible with wayland
# xwayland disable

View File

@@ -1,16 +0,0 @@
# sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment
# See FS#63021
# Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal.
# Upstream refuses to set XDG_CURRENT_DESKTOP so we have to.
exec systemctl --user set-environment XDG_CURRENT_DESKTOP=sway
exec systemctl --user import-environment DISPLAY \
SWAYSOCK \
WAYLAND_DISPLAY \
XDG_CURRENT_DESKTOP
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY \
SWAYSOCK \
XDG_CURRENT_DESKTOP=sway \
WAYLAND_DISPLAY

View File

@@ -1,12 +1,25 @@
# Apply xed settings with self-destructing script
exec ~/.config/sway/scripts/xed_setup.sh
# Auth with polkit-gnome:
exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# Import environment variables for user systemd service manager
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
# Update dbux environments with display variables
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
# Desktop notifications
exec mako
# Network Applet
exec nm-applet --indicator
# Start foot server
exec_always --no-startup-id foot --server
# Autotiling
exec_always ~/.config/sway/scripts/autotiling

View File

@@ -1,32 +1,20 @@
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
# Add Vim key support
set $left h
set $down j
set $up k
set $right l
# audio control
set $sink_volume pactl get-sink-volume @DEFAULT_SINK@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//'
set $source_volume pactl get-source-volume @DEFAULT_SOURCE@ | grep '^Volume:' | cut -d / -f 2 | tr -d ' ' | sed 's/%//'
set $volume_down $(pactl set-sink-volume @DEFAULT_SINK@ -5% && $sink_volume)
set $volume_up $(pactl set-sink-volume @DEFAULT_SINK@ +5% && $sink_volume)
set $volume_mute $(pactl set-sink-mute @DEFAULT_SINK@ toggle && pactl get-sink-mute @DEFAULT_SINK@ | sed -En "/no/ s/.*/$($sink_volume)/p; /yes/ s/.*/0/p")
set $mic_mute $(pactl set-source-mute @DEFAULT_SOURCE@ toggle && pactl get-source-mute @DEFAULT_SOURCE@ | sed -En "/no/ s/.*/$($source_volume)/p; /yes/ s/.*/0/p")
# Start foot server
exec_always --no-startup-id foot --server
# Set default terminal emulator
set $term footclient
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu wofi -c ~/.config/wofi/config -I
# Application launcher
set $launcher fuzzel
set $powermenu ~/.config/waybar/scripts/power-menu.sh
# Power Menu
set $powermenu ~/.config/sway/scripts/power_menu.sh
### Idle configuration
exec swayidle -w\
@@ -55,16 +43,14 @@ exec swayidle -w\
bindsym $mod+q kill
# Start your launcher
bindsym $mod+d exec $menu
bindsym $mod+d exec $launcher
# Activities
bindsym $mod+p exec ~/.config/wofi/windows.py
bindsym $mod+p exec ~/.config/sway/scripts/window_switcher.sh
# Drag floating windows by holding down $mod and left mouse button.
# Move windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
# Change "normal" to "inverse" to switch left and right
floating_modifier $mod normal
# Reload the configuration file
@@ -73,27 +59,28 @@ exec swayidle -w\
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
# Change window focus
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Vim key support
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
# Move the focused window
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# Vim key support
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
#
# Workspaces:
#
@@ -121,14 +108,15 @@ exec swayidle -w\
bindsym $mod+Shift+0 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.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
# Set how the current window will be split
# Split the window vertically
bindsym $mod+v splitv
# Split the window horizontally
bindsym $mod+b splith
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
@@ -138,7 +126,7 @@ exec swayidle -w\
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
# Toggle between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
@@ -161,30 +149,25 @@ exec swayidle -w\
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $right resize grow width 10px
bindsym $up resize shrink height 10px
bindsym $down resize grow height 10px
mode "resize" {
# Resize with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Resize with Vim keys
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Right resize grow width 10px
bindsym Up resize shrink height 10px
bindsym Down resize grow height 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Resize floating windows with mouse scroll:
# Resize floating windows with mouse scroll:
bindsym --whole-window --border $mod+button4 resize shrink height 5 px or 5 ppt
bindsym --whole-window --border $mod+button5 resize grow height 5 px or 5 ppt
bindsym --whole-window --border $mod+Shift+button4 resize shrink width 5 px or 5 ppt
@@ -193,20 +176,13 @@ bindsym $mod+r mode "resize"
#
# Volume
#
# Control volume trough pamixer
# bindsym --locked XF86AudioRaiseVolume exec pamixer -ui 2
# bindsym --locked XF86AudioLowerVolume exec pamixer -ud 2
# bindsym --locked XF86AudioMute exec pamixer -t
# Control volume directly trough pactl
bindsym --locked XF86AudioRaiseVolume exec $volume_up
bindsym --locked XF86AudioLowerVolume exec $volume_down
bindsym --locked XF86AudioMute exec $volume_mute
bindsym XF86AudioRaiseVolume exec pamixer -ui 2
bindsym XF86AudioLowerVolume exec pamixer -ud 2
bindsym XF86AudioMute exec pamixer --toggle-mute
#
# Player
#
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#

0
.config/sway/scripts/clamshell.sh Normal file → Executable file
View File

0
.config/sway/scripts/import-gsettings Normal file → Executable file
View File

0
.config/sway/scripts/lockman.sh Normal file → Executable file
View File

View File

@@ -0,0 +1,34 @@
#!/bin/bash
SELECTION="$(printf "1 - Lock\n2 - Suspend\n3 - Log out\n4 - Reboot\n5 - Reboot to UEFI\n6 - Shutdown" | fuzzel --dmenu -a top-right -l 6 -w 20 -p "Select an option: ")"
confirm_action() {
local action="$1"
CONFIRMATION="$(printf "No\nYes" | fuzzel --dmenu -a top-right -l 2 -w 20 -p "$action?")"
[ "$CONFIRMATION" = "Yes" ]
}
case $SELECTION in
*"Lock")
swaylock;;
*"Suspend")
if confirm_action "Suspend"; then
systemctl suspend
fi;;
*"Log out")
if confirm_action "Log out"; then
swaymsg exit
fi;;
*"Reboot")
if confirm_action "Reboot"; then
systemctl reboot
fi;;
*"Reboot to UEFI")
if confirm_action "Reboot to UEFI"; then
systemctl reboot --firmware-setup
fi;;
*"Shutdown")
if confirm_action "Shutdown"; then
systemctl poweroff
fi;;
esac

0
.config/sway/scripts/swayfader.py Normal file → Executable file
View File

0
.config/sway/scripts/weather.sh Normal file → Executable file
View File

View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Define the lengths for each column
ws_length=2
app_id_length=14
name_length=50
# Fetch the data from swaymsg and format it
formatted_output=$(swaymsg -t get_tree | jq -r --arg ws_length "$ws_length" --arg app_id_length "$app_id_length" --arg name_length "$name_length" '
def lpad($len; $char):
if (.|length) > $len then $char * ($len - (.|length)) +.[:$len-1] + "\u2026" else $char * ($len - (.|length)) +. end;
def rpad($len; $char):
if (.|length) > $len then.[:$len-1] + "\u2026" else. + $char * ($len - (.|length)) end;
..
| objects
| select(.type == "workspace") as $ws
|..
| objects
| select(has("app_id"))
| (if.focused then "*" else " " end) as $asterisk
| "\($asterisk)[\($ws.name | lpad($ws_length | tonumber; " "))]\((.app_id // "xwayland") | lpad($app_id_length | tonumber; " ")): \(.name | rpad($name_length | tonumber; " ")) (\(.id))"
')
# Launch fuzzel with the formatted output
row=$(echo "$formatted_output" | fuzzel --dmenu --width=80 --lines=12)
# Get the container ID from the selection and focus the container
if [ -n "$row" ]; then
winid="${row##*(}"
winid="${winid%%)*}"
swaymsg "[con_id=$winid] focus"
fi

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Apply xed settings
dbus-launch dconf load / < $HOME/.config/xed.dconf
# Notify user settings have been applied
notify-send -i /usr/share/icons/Qogir/48/apps/accessories-text-editor.svg "Custom xed settings have been applied. "
# Remove xed.dconf file
rm $HOME/.config/xed.dconf
# Remove xed_setup.sh from autostart config
sed -i "/# Apply xed settings with self-destructing script/,+2d" $HOME/.config/sway/config.d/autostart_applications
# Remove this script
rm $HOME/.config/sway/scripts/xed_setup.sh

View File

@@ -35,7 +35,7 @@
"custom/launcher": {
"format":"<span size='x-large'></span>",
"on-click": "exec wofi -c ~/.config/wofi/config -I",
"on-click": "exec fuzzel",
"tooltip": false,
},
@@ -183,7 +183,7 @@
"custom/power": {
"format":"⏻",
"on-click": "exec ~/.config/waybar/scripts/power-menu.sh",
"on-click": "exec ~/.config/sway/scripts/power_menu.sh",
"tooltip": false,
},
}

2
.config/waybar/scripts/keyhint.sh Normal file → Executable file
View File

@@ -1,2 +1,2 @@
#!/bin/sh
yad --title="EndeavourOS Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(Foot)" "+d" "Application Menu" "(wofi)" "+p" "Activities" "(wofi)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(wofi)" "+t" "open keybinding helper" "full list"
yad --title="EndeavourOS Sway-WM keybindings:" --no-buttons --geometry=400x345-15-400 --list --column=key: --column=description: --column=command: "ESC" "close this app" "" "=" "modkey" "(set mod Mod4)" "+enter" "Terminal" "(Foot)" "+d" "Application Menu" "(Fuzzel)" "+p" "Activities" "(Fuzzel)" "+o" "" "Open Broswer" "+n" "" "Open Files" "+q" "close focused app" "(kill)" "[Shift]+Print-key" "screenshot" "(grim)" "+Shift+e" "power-menu" "(Fuzzel)" "+t" "open keybinding helper" "full list"

View File

@@ -1,16 +0,0 @@
#!/bin/bash
entries="Logout Suspend Reboot Shutdown"
selected=$(printf '%s\n' $entries | wofi --conf=$HOME/.config/wofi/config.power --style=$HOME/.config/wofi/style.widgets.css | awk '{print tolower($1)}')
case $selected in
logout)
swaymsg exit;;
suspend)
exec systemctl suspend;;
reboot)
exec systemctl reboot;;
shutdown)
exec systemctl poweroff -i;;
esac

0
.config/waybar/scripts/weather.sh Normal file → Executable file
View File

View File

@@ -68,7 +68,6 @@
#battery,
#backlight,
#clock,
#temperature,
#custom-weather,
#tray {
padding:0.5rem 0.6rem;
@@ -185,10 +184,6 @@
font-size: 13px;
}
#temperature.critical {
color: red;
}
#custom-power {
margin-left:15px;
margin-right:15px;

View File

@@ -1,18 +0,0 @@
hide_scroll=true
show=drun
width=25%
lines=10
line_wrap=word
term=footclient
allow_markup=true
always_parse_args=true
show_all=true
print_command=true
layer=overlay
allow_images=true
insensitive=true
prompt=
image_size=15
display_generic=true
location=center
columns=2

View File

@@ -1,9 +0,0 @@
hide_search=true
hide_scroll=true
insensitive=true
show=dmenu
width=100
lines=4
location=top_right
x=-120
y=10

View File

@@ -1,9 +0,0 @@
hide_search=true
hide_scroll=true
insensitive=true
width=1
show=dmenu
lines=5
location=centre
x=870
y=455

View File

@@ -1,48 +0,0 @@
/*
Arc-Dark Color Scheme
*/
@define-color highlight #5294e2;
@define-color base1 #404552;
@define-color base2 #404552;
@define-color base3 #4b5160;
*{
font-family: UbuntuMono;
}
window {
border: 1px solid @highlight;
background-color: @base1;
}
#input {
margin-bottom: 15px;
padding:3px;
border-radius: 5px;
border:none;
color: black;
}
#inner-box {
background-color: @base3;
}
#outer-box {
margin: 5px;
padding:15px;
background-color: @base2;
}
#text {
padding: 5px;
color: white;
}
#entry:nth-child(even) {
background-color: @base1;
}
#entry:selected {
background-color: @highlight;
}

View File

@@ -1,45 +0,0 @@
/*
Arc-Dark Color Scheme
*/
@define-color highlight #5294e2;
@define-color base1 #404552;
@define-color base2 #40455;
@define-color base3 #4b5160;
*{
font-family: UbuntuMono;
}
#window {
border: 1px solid @highlight;
margin: 0px 5px 0px 5px;
}
#inner-box {
background-color: @base2;
}
#outer-box {
margin: 5px;
padding:10px;
background-color: @base2;
margin-top: -22px;
}
#text {
padding: 5px;
color: white;
}
#entry:nth-child(even) {
background-color: @base1;
}
#entry {
background-color: @base3;
}
#entry:selected {
background-color: @highlight;
}

View File

@@ -1,119 +0,0 @@
#!/bin/python3
import json
import subprocess
from argparse import ArgumentParser
ENTER = "\n"
def get_windows():
command = "swaymsg -t get_tree"
process = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
process = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
data = json.loads(process.communicate()[0])
# Select outputs that are active
windows = []
for output in data["nodes"]:
# The scratchpad (under __i3) is not supported
if output.get("name") != "__i3" and output.get("type") == "output":
workspaces = output.get("nodes", [])
for ws in workspaces:
if ws.get("type") == "workspace":
windows.extend(extract_nodes_iterative(ws))
return windows
# Extracts all windows from a sway workspace json object
def extract_nodes_iterative(workspace):
all_nodes = []
floating_nodes = workspace.get("floating_nodes", [])
for floating_node in floating_nodes:
all_nodes.append(floating_node)
nodes = workspace.get("nodes", [])
for node in nodes:
# Leaf node
if not node.get("nodes"):
all_nodes.append(node)
# Nested node, handled iterative
else:
for inner_node in node.get("nodes"):
nodes.append(inner_node)
return all_nodes
# Returns an array of all windows
def parse_windows(windows):
return [window.get("name") for window in windows]
# Returns a newline seperated UFT-8 encoded string of all windows for wofi
def build_wofi_string(windows):
return ENTER.join(windows).encode("UTF-8")
# Executes wofi with the given input string
def show_wofi(windows):
command = 'wofi -c ~/.config/wofi/menu -s ~/.config/wofi/style.css -p "Windows: " -d -i --hide-scroll'
process = subprocess.Popen(
command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
return process.communicate(input=windows)[0]
# Returns the sway window id of the window that was selected by the user inside wofi
def parse_id(windows, parsed_windows, selected):
if not selected:
return None
else:
selected = (selected.decode("UTF-8"))[:-1] # Remove new line character
window_index = int(
parsed_windows.index(selected)
) # Get index of selected window in the parsed window array
return str(
windows[window_index].get("id")
) # Get sway window id based on the index
# Switches the focus to the given id
def switch_window(id):
command = "swaymsg [con_id={}] focus".format(id)
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
process.communicate()[0]
# Entry point
if __name__ == "__main__":
parser = ArgumentParser(description="Wofi based window switcher")
windows = get_windows()
parsed_windows = parse_windows(windows)
wofi_string = build_wofi_string(parsed_windows)
selected = show_wofi(wofi_string)
# Otherwise no point in running
if selected:
selected_id = parse_id(windows, parsed_windows, selected)
switch_window(selected_id)

6
.config/xed.dconf Normal file
View File

@@ -0,0 +1,6 @@
[org/x/editor/preferences/editor]
bracket-matching=false
display-line-numbers=true
prefer-dark-theme=true
scheme='cobalt'
wrap-mode='none'