• Stars
    star
    158
  • Rank 237,131 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GTK3-based dock for sway

nwg-dock

This application is a part of the nwg-shell project.

Contributing: please read the general contributing rules for the nwg-shell project.

For Hyprland support please use nwg-dock-hyprland.

Fully configurable (w/ command line arguments and css) dock, written in Go, aimed exclusively at sway Wayland compositor. It features pinned buttons, task buttons, the workspace switcher and the launcher button. The latter by default starts nwg-drawer or nwggrid (application grid) - if found. In the picture(s) below the dock has been shown together with nwg-panel.

screenshot-1.png

Packaging status

Installation

Requirements

  • go>=1.20 (just to build)
  • gtk3
  • gtk-layer-shell
  • nwg-drawer or nwg-launchers: optionally. You may use another launcher (see help), or none at all. The launcher button won't show up, if so.

Steps

  1. Clone the repository, cd into it.
  2. Install golang libraries with make get. First time it may take ages, be patient.
  3. make build
  4. sudo make install

Running

Either start the dock permanently in the sway config file,

exec nwg-dock [arguments]

or assign the command to some key binding. Running the command again kills the existing program instance, so that you could use the same key to open and close the dock.

Running the dock residently

If you run the program with the -d or -r argument (preferably in autostart), it will be running residently.

exec_always nwg-dock -d

or

exec_always nwg-dock -r

-d for autohiDe

Move the mouse pointer to expected dock location for the dock to show up. It will be hidden a second after you leave the window. Invisible hot spots will be created on all your outputs, unless you specify one with the -o argument.

-r for just Resident

No hotspot will be created. To show/hide the dock, bind the exec nwg-dock command to some key or button. How about the Menu key, which is usually useless?

Re-execution of the same command hides the dock. If a resident instance found, the nwg-dock command w/o arguments sends SIGUSR1 to it. Actually pkill -USR1 nwg-dock could be used instead. This also works in autohiDe mode.

Re-execution of the command with the -d or -r argument won't kill the running instance. If the dock is running residently, another instance will just exit with 0 code. In case you'd like to terminate it anyway, you need to pkill -f nwg-dock.

NOTE: you need to kill the running instance before reloading sway, if you've just changed the arguments you auto-start the dock with.

nwg-dock -h
Usage of nwg-dock:
  -a string
    	Alignment in full width/height: "start", "center" or "end" (default "center")
  -c string
    	Command assigned to the launcher button
  -d	auto-hiDe: show dock when hotspot hovered, close when left or a button clicked
  -debug
    	turn on debug messages
  -f	take Full screen width/height
  -i int
    	Icon size (default 48)
  -l string
    	Layer "overlay", "top" or "bottom" (default "overlay")
  -mb int
    	Margin Bottom
  -ml int
    	Margin Left
  -mr int
    	Margin Right
  -mt int
    	Margin Top
  -nolauncher
    	don't show the launcher button
  -nows
    	don't show the workspace switcher
  -o string
    	name of Output to display the dock on
  -p string
    	Position: "bottom", "top" or "left" (default "bottom")
  -r	Leave the program resident, but w/o hotspot
  -s string
    	Styling: css file name (default "style.css")
  -v	display Version information
  -w int
    	number of Workspaces you use (default 8)
  -x	set eXclusive zone: move other windows aside; overrides the "-l" argument

screenshot-2.png

Styling

Edit ~/.config/nwg-dock/style.css to your taste.

Troubleshooting

An application icon is not displayed

The only thing the dock knows about the app is it's app_id.

$ swaymsg -t get_tree
(...)
        #13: con "piotr@msi:~" (xdg_shell, pid: 8512, app_id: "foot")

Now it'll look for an icon named 'foot'. If that fails, it'll look for a .desktop file named 'foot.desktop', which should contain the icon name or path. If this fails as well, no icon will be displayed. I've added workarounds for some most common exceptions, but it's impossible to predict every single application misbehaviour. This is either programmers fault (improper class name), or bad packaging (.desktop file name different from the application class name).

If some app has no icon in the dock:

  1. check the app class name (swaymsg -t get_tree);
  2. find the app's .desktop file;
  3. copy it to ~/.local/share/applications/` and rename to <class_name>.desktop.

If the .desktop file contains proper icon definition (Icon=), it should work now.

Credits

This program uses some great libraries:

  • gotk3 Copyright (c) 2013-2014 Conformal Systems LLC, Copyright (c) 2015-2018 gotk3 contributors
  • gotk3-layershell by @dlasky - many thanks for writing this software, and for patience with my requests!
  • go-sway Copyright (c) 2019 Joshua Rubin
  • go-singleinstance Copyright (c) 2015 Allan Simon

More Repositories

1

autotiling

Script for sway and i3 to automatically switch the horizontal / vertical window split orientation
Python
872
star
2

nwg-shell

Installer & meta-package for the nwg-shell project: a GTK3-based shell for sway and Hyprland Wayland compositors
CSS
793
star
3

nwg-panel

GTK3-based panel for sway and Hyprland Wayland compositors
Python
583
star
4

nwg-look

GTK3 settings editor adapted to work in the wlroots environment
Go
476
star
5

nwg-launchers

GTK-based launchers: application grid, button bar, dmenu for sway and other window managers
C++
401
star
6

nwg-displays

Output management utility for sway and Hyprland.
Python
356
star
7

azote

Wallpaper manager for wlroots-based compositors and some other WMs
Python
351
star
8

nwg-drawer

Application drawer for wlroots-based Wayland compositors
Go
229
star
9

nwg-dock-hyprland

GTK3-based dock for Hyprland
Go
153
star
10

nwg-wrapper

Wrapper to display a script output or a text file content on the desktop in sway or other wlroots-based compositors
Python
135
star
11

nwg-bar

GTK3-based button bar for wlroots-based compositors
Go
115
star
12

sgtk-menu

GTK launchers for sway & other WMs w/ menu, dmenu, application grid and button bar
Python
112
star
13

tint2-executors

Collection of executors for Tint2 panel
Python
83
star
14

nwg-iso

Arch Linux ISO with nwg-shell for sway and Hyprland
CSS
76
star
15

nwg-shell-config

nwg-shell configuration utility
Python
57
star
16

nwg-menu

MenuStart plugin to nwg-panel, also capable of working standalone
Go
54
star
17

swayinfo

Some goodies for use in Sway and i3 wm
Python
48
star
18

gopsuinfo

A gopsutil-based command to display system usage info as text in panels like Waybar or icon/text in tint2 and nwg-panel executors
Go
33
star
19

psuinfo

A psutil-based command to display customizable system usage info in a single line, for Tint2 executors or CLI
Python
28
star
20

nwg-hello

GTK3-based greeter for greetd written in python
Python
26
star
21

t2ec

Package of info scripts for Tint2 or other panels
Python
17
star
22

nwg-icon-picker

GTK icon chooser with a text search option
Python
16
star
23

nwg-clipman

nwg-shell clipboard manager - a GTK3-based GUI for cliphist
Python
15
star
24

nwgocc

nwg Control Center - Go version
Go
14
star
25

obhud

Openbox HUD ia s Python script for handling laptop-specific keys and events in Openbox window manager
Python
8
star
26

azote-palettes

Create a color palette out of an image
Python
6
star
27

nwgcc

nwg Control Center
Python
6
star
28

nwg-piotr

Config files for my GitHub profile.
5
star
29

rof

Launcher script to avoid running multiple instance of the same window
Shell
5
star
30

ddcpopup

simple GUI for basic ddcutil features and a ddcutil output parser for use with bars / panels
Go
4
star
31

sway-save-outputs

Script to save current sway outputs configuration to a text file
Python
4
star
32

lightdm-nwg-greeter

A fork of LightDM Elephant Greeter, intended to replace sddm on nwg-iso.
Python
3
star
33

RamblerGPXEditor

An Openstreetmap-based visual GPX editor for Android
Java
3
star
34

squarely

A puzzle game which utilizes the python-pyglet library.
Python
3
star
35

dwl

djpohly/dwl with my selection of patches and pending pull requests applied
C
3
star
36

nwg-readme-browser

WebKitGTK-based README file browser
Python
3
star
37

obbackup

Simple graphical tool to backup/restore Openbox config files in few clicks
Python
2
star
38

EistReturns

Arcade-puzzle game
Java
2
star
39

nwg-shell-wallpapers

Selection of wallpapers contributed to the nwg-shell project
Shell
2
star
40

nwg-shell-resources

common files used by other nwg-shell components
CSS
2
star
41

river_output_switcher

automated output switcher for river Wayland compositor
Python
1
star