GTK3-based dock for sway

Overview

nwg-dock

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 nwggrid (application grid) from nwg-launchers. In the picture(s) below the dock has been shown together with nwg-panel.

06.png

more pictures

Installation

Requirements

  • go up to 1.16.2: just to build. See the note below.
  • gtk3
  • gtk-layer-shell
  • nwg-launchers: optionally. You may use another launcher, see help.

Note: For go 1.16.3 a more recent gotk3 version would be necessary. For now I tried the 86f85cbecd0b990beab32a3471b08ad3cdd8f93b commit and it worked, but would give me deprecation warnings. It also needed some changes to the code, as glib.TimeoutAdd now returns just int, w/o error. Let's wait a little bit more.

Steps

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

Or you may skip 1 and 2, and try just sudo make install. You've downloaded the binary in the /bin directory.

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 existing program instance, so you may use the same key to open and close the dock.

Running in autohiDe mode

If you run the program with the -d argument, it will start up hidden. 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 or use a button. Invisible hot spots to activate the dock will be created on all your outputs, unless you specify one with the -o argument.

As the dock in autohide mode is expected to be started from the sway config with

exec_always nwg-dock -d

...re-execution of the command with the -d argument won't kill the running instance. If the dock is already running, another instance will exit with 0 code. In case you'd like to terminate it anyway, just use the nwg-dock command with no argument.

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 (default "nwggrid -p")
  -d	auto-hiDe: show dock when hotspot hovered, close when left or a button clicked
  -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
  -o string
    	name of Output to display the dock on
  -p string
    	Position: "bottom", "top" or "left" (default "bottom")
  -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

Styling

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

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
Comments
  • [Feature request] Take cursor acceleration into account when revealing hidden dock

    [Feature request] Take cursor acceleration into account when revealing hidden dock

    Suggestion: When the dock is in autohide mode, do not unhide the dock unless the mouse reaches a certain threshold of downwards velocity when it is moving to the dock's trigger area.

    Benefit: This will prevent users from accidentally revealing the dock and obscuring the bottom of windows they may be trying to work with during regular use.

    Not sure if this is feasible/possible to implement in this project, but just a suggestion because it works really well in GNOME's dock to shell extension's implementation of it.

    enhancement 
    opened by zoro11031 17
  • nwg-dock workspace switching by touch

    nwg-dock workspace switching by touch

    Hello.

    I use nwg-dock together with waybars on a pineNote.

    The situation is that when I switch app using pressing pen or mouse on the app icon workspace is switched to proper one for the app. However when I touch an icon on a screen with a finger, icon is highlighted but not switched to the app or workspace.

    Is this intended? Is there an command line option to change it? If not where to start the change in a code to modify this behavior?

    Thank for this app. Jaźń.

    opened by jazn 15
  • ARM Compatibility (rpi4)

    ARM Compatibility (rpi4)

    Hi,

    Im using archlinux (aarch64) on the Raspberry pi 4.

    Well, it compiles and everything looks fine, but after the compilation and installation, i get: -bash: /usr/bin/nwg-dock: cannot execute binary file: Exec format error

    Isn't that weird, because i compiled it on the pi4 itself?

    opened by Ramalama2 14
  • High CPU utilisation

    High CPU utilisation

    I'm running nwg-dock 0.2.2 from AUR on Arch with sway from git (sway 1.8-dev-cd1ee0e1) on a recent laptop, and nwg-dock constantly uses about 10% of CPU.

    nwg-dock -debug doesn't show anything suspicious.

    I'm using Go and gtk-layer-shell versions 2:1.17.6-2 and 0.7.0-1 respectively.

    opened by haselwarter 9
  • FreeBSD compile error gtk-layer-shell pango library error

    FreeBSD compile error gtk-layer-shell pango library error

    Pango_attr_insert_hyphens_new undefined error I’m sure you’ve seen this error on Linux build it carries over to bad I’m to get it to build by rewriting parts of the pango header file but haven’t had any luck yet

    opened by justfly1111 9
  • Compile error with Debian

    Compile error with Debian

    With Debian testing, getting the following build error (can build fine on Arch Linux):

    $ make get
    go get github.com/gotk3/[email protected]
    go get github.com/gotk3/gotk3/gdk
    go: found github.com/gotk3/gotk3/gdk in github.com/gotk3/gotk3
    v0.5.3-0.20210223154815-289cfb6dbf32
    go get github.com/gotk3/gotk3/glib
    go: found github.com/gotk3/gotk3/glib in github.com/gotk3/gotk3
    v0.5.3-0.20210223154815-289cfb6dbf32
    go get github.com/dlasky/gotk3-layershell/layershell
    go: found github.com/dlasky/gotk3-layershell/layershell in github.com/dlasky/gotk3-layershell
    v0.0.0-20210331230524-5cca0b819261
    # github.com/dlasky/gotk3-layershell/layershell
    ../../.go/pkg/mod/github.com/dlasky/[email protected]/layershell/layer.go:93:35:
    could not determine kind of name for C.GtkLayerShellKeyboardMode
    ../../.go/pkg/mod/github.com/dlasky/[email protected]/layershell/layer.go:93:2:
    could not determine kind of name for C.gtk_layer_set_keyboard_mode
    make: *** [Makefile:5: get] Error 2
    

    libgtk-layer-shell-dev 0.5.2-1, go1.15.9

    Worth asking @dlasky too

    opened by rbutoi 8
  • Compile fail on openSUSE Tumbleweed

    Compile fail on openSUSE Tumbleweed

    Describe the bug During command make build I get following error (2): nwg-dock git:(main) ✗ make build go build -o bin/nwg-dock . \# github.com/gotk3/gotk3/glib cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_source’: cgo-gcc-prolog:71:2: warning: ‘g_binding_get_source’ is deprecated: Use 'g_binding_dup_source' instead [-Wdeprecated-declarations] In file included from /usr/include/glib-2.0/glib-object.h:24, from /usr/include/glib-2.0/gio/gioenums.h:30, from /usr/include/glib-2.0/gio/giotypes.h:30, from /usr/include/glib-2.0/gio/gio.h:28, from ../go/pkg/mod/github.com/gotk3/[email protected]/glib/gbinding.go:3: /usr/include/glib-2.0/gobject/gbinding.h:115:23: note: declared here 115 | GObject * g_binding_get_source (GBinding *binding); | ^~~~~~~~~~~~~~~~~~~~ cgo-gcc-prolog: In function ‘_cgo_200740c87a77_Cfunc_g_binding_get_target’: cgo-gcc-prolog:107:2: warning: ‘g_binding_get_target’ is deprecated: Use 'g_binding_dup_target' instead [-Wdeprecated-declarations] /usr/include/glib-2.0/gobject/gbinding.h:119:23: note: declared here 119 | GObject * g_binding_get_target (GBinding *binding); | ^~~~~~~~~~~~~~~~~~~~ \# github.com/nwg-piotr/nwg-dock ./tools.go:69:12: cannot use window.Change (variable of type sway.WindowEventChange) as type string in struct literal ./tools.go:87:33: cannot use eventHandler (variable of type swayEventHandler) as type sway.EventHandler in argument to sway.Subscribe: swayEventHandler does not implement sway.EventHandler (missing BarStateUpdate method) ./tools.go:117:33: cannot use eventHandler (variable of type swayEventHandler) as type sway.EventHandler in argument to sway.Subscribe: swayEventHandler does not implement sway.EventHandler (missing BarStateUpdate method) make: *** [Makefile:11: build] Error 2

    To Reproduce Steps to reproduce the behavior:

    1. Clone repository
    2. cd into repository folder
    3. run command make get
    4. run command make build
    5. See the error

    Expected behavior I expect succesful build to proceed to running command sudo make install

    Screenshots 2022-11-21-070010_screenshot

    Desktop (please complete the following information):

    • Linux distribution : openSUSE Tumbleweed x86_64
    • go version : go version go1.19.3 linux/amd64
    • gtk-layer-shell version: 0.8.0-1.1
    opened by jasek5 7
  • Fix High CPU utilization

    Fix High CPU utilization

    This PR fixes Issue #24. Now tasks are only loaded if changes are detected (opening / closing windows or modifying the UI). I have not fully tested everything, so it is possible that not all state changes are tracked correctly and may result in an inconsistent state of the user interface.

    opened by Raffy23 6
  • No icons for workspace switcher and drawer

    No icons for workspace switcher and drawer

    Describe the bug When running nwg-dock, the icons for the ws and drawer aren't loaded, the two buttons become very thin, and do nothing when clicked.

    To Reproduce Steps to reproduce the behavior:

    1. Download package from AUR or chaotic-aur
    2. Run nwg-dock

    Expected behavior The svg icons installed with the program should be used, and the buttons should be functional.

    Screenshot test (Ingore the styling since there's no css file. Issue even if copying over the default css file.)

    Desktop (please complete the following information):

    • Arch Linux
    • Go version: N/A for chaotic-aur, 1.17 for compiling from AUR
    • gtk-layer-shell version: 0.6.0

    Additional context

    Using auto-detected launcher command: 'nwg-drawer'
    Copying file: /home/cheer/.config/nwg-dock/style.css
    /home/cheer/.config/nwg-dock/style.css file not found, using GTK styling
    (0x55980473d9a8,0xc000013ff0)
    (0x55980473d9a8,0xc00027e080)
    
    ** (nwg-dock:758083): WARNING **: 21:24:55.737: gtk-layer-shell v0.6.0 may not work on GTK v3.24.30. If you experience crashes, check https://github.com/wmww/gtk-layer-shell/blob/master/compatibility.md
    refreshing...
    (0x55980473d9a8,0xc000113e60)
    (0x55980473d9a8,0xc000113ef0)
    
    opened by Mrfiregem 6
  • river support

    river support

    nwg-dock appears to depend on a sway-specific feature, and crashes when trying to run it on other Wayland compositors like river.

    FATA[0000] Couldn't list tasks:$SWAYSOCK is empty
    
    opened by j-james 5
  • Respect XDG environment variables

    Respect XDG environment variables

    Describe the bug I noticed some paths to XDG directories /usr/share are hardcoded, which prevents nwg-dock working on some Linux environments that don't obey Linux FHS such as NixOS.

    To Reproduce Steps to reproduce the behavior:

    1. Change XDG_DATA_DIRS or XDG_DATA_HOME and put the resources there
    2. Run

    Expected behavior The dock icons are shown correctly.

    Screenshots

    Desktop (please complete the following information):

    • NixOS
    • Go 1.16.2
    • 0.6.0

    Additional context I found a suitable Go library though I haven't tested it yet. https://github.com/adrg/xdg

    opened by sei40kr 5
  • [Feature] Use Scratchpad as minimize/maximize when clicking an open application

    [Feature] Use Scratchpad as minimize/maximize when clicking an open application

    I know the nwg-panel already has this implemented, but would it be possible to also implement this in the dock? For me it would feel redundant to have two separate UI pieces show my open applications, and I prefer using the dock over the panel module :).

    I know the behavior right now is that when you click an open app it takes you to the workspace that that app is running on if you are not already there. To prevent breaking that for those who rely on this feature, maybe have it be an optional toggle in the dock? Alternatively, it could be a right click context menu to minimize, and then if it's detected that the app is running in scratchpad, a regular click would reveal it from scratchpad (not sure if this idea is actually possible to implement with the way Wayland works, I know there's some issues with applications detecting the state of windows for separate apps. If it's not possible just disregard it haha)

    enhancement 
    opened by zoro11031 1
  • Some pinned desktop entries cannot be launched from dock due to command line parsing

    Some pinned desktop entries cannot be launched from dock due to command line parsing

    Describe the bug Some desktop entries do not launch from nwg-dock due to how command line arguments are handled. Specifically, having the passed parameter %F in the Exec statement of a .desktop file along with other command line flags seems to prevent the application from launching.

    To Reproduce Steps to reproduce the behavior:

    1. Open an application that supports %F as a parameter and pin to the dock (to reproduce this, I used code-oss).
    2. Update the desktop entry for that application (in my case /usr/share/applications/code-oss.desktop) to contain an Exec statement containing %F. For example Exec=/usr/bin/code-oss --enable-features=UseOzonePlatform --ozone-platform=wayland --unity-launch %F.
    3. Close the application.
    4. Try to re-open it from the dock. If nwg-dock is started from a terminal the following debugging statement is logged, indicating that the actual command name has been truncated. env vars: ["--enable-features=UseOzonePlatform --ozone-platform=wayland]; command: '--unity-launch'; args: []

    Expected behavior nwg-dock should launch the application with all command line flags intact.

    Desktop (please complete the following information):

    • Arch Linux (5.13.6-arch1-1)
    • wayland 1.19.0-1
    • go 1.16.5
    • gtk-layer-shell 0.6.0-1

    Additional context The same desktop entry launches from gtk-launch, bemenu, etc. just fine. I'm not sure if there's another way to format my Exec statement to make this work or if nwg-dock is just tripping up on just %F or all passed parameters, but I thought I'd report this anyway. I haven't written any Go in forever but when I have some time I might be able to track down the bug and submit a PR if you're too busy. Thanks. :)

    opened by supernintendo 1
Releases(v0.3.3)
Owner
Piotr Miller
After hours developer, Linux fan, Arch Linux user
Piotr Miller
wsmgr-for-i3 is a Go GTK3 program to manage i3 workspaces.

wsmgr-for-i3 wsmgr-for-i3 (workspace manager for i3) is a Go GTK3 program to manage i3 workspaces. It allows you to re-order and re-name workspaces ea

Michael Stapelberg 30 Nov 5, 2022
A rewrite of DrPetter's sfxr in Go and GTK3

gosfxr This is a rewrite of DrPetter's sfxr in Go and GTK3 that only exists because I wanted to get my feet wet with UI development in Go. Please refe

null 0 Dec 27, 2021
Cross platform GUI in Go based on Material Design

About Fyne is an easy to use UI toolkit and app API written in Go. It is designed to build applications that run on desktop and mobile devices with a

Fyne.io 19.1k Jan 3, 2023
GPU based Electron on a diet

Muon is a lightweight alternative to Electron written in Golang in about ~300 LoC, using Ultralight instead of Chromium. Ultralight is a cross-platfor

V-X 2.7k Jan 2, 2023
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

null 5.5k Jan 9, 2023
Cross platform rapid GUI framework for golang based on Dear ImGui.

giu Cross platform rapid GUI framework for golang based on Dear ImGui and the great golang binding imgui-go. Any contribution (features, widgets, tuto

Allen Dang 1.6k Dec 28, 2022
A minimal material design based UI toolkit for Tiny Go projects

A minimal material design based UI toolkit for Tiny Go projects.

null 27 Sep 3, 2022
go-gtk3 - GTK3 BINDINGS FOR GO

go-gtk3 - GTK3 BINDINGS FOR GO THIS IS: Hopefully GTK3 Bindings using gobject binding for Go. Goal is to have fairly complete gtk3 widgets with pango

nori satir 57 May 25, 2021
A simple Go utility to display track information from, and send commands to, spotifyd from Tiling Window Managers like Sway and i3

Untitled Spotifyd Controller A simple Go utility to display track information from, and send commands to, spotifyd from Tiling Window Managers like Sw

Matt 2 Mar 8, 2022
Go bindings for GTK3

gotk3 The gotk3 project provides Go bindings for GTK 3 and dependent projects. Each component is given its own subdirectory, which is used as the impo

gotk3 1.9k Jan 6, 2023
wsmgr-for-i3 is a Go GTK3 program to manage i3 workspaces.

wsmgr-for-i3 wsmgr-for-i3 (workspace manager for i3) is a Go GTK3 program to manage i3 workspaces. It allows you to re-order and re-name workspaces ea

Michael Stapelberg 30 Nov 5, 2022
A rewrite of DrPetter's sfxr in Go and GTK3

gosfxr This is a rewrite of DrPetter's sfxr in Go and GTK3 that only exists because I wanted to get my feet wet with UI development in Go. Please refe

null 0 Dec 27, 2021
Time-Based One-Time Password (TOTP) and HMAC-Based One-Time Password (HOTP) library for Go.

otpgo HMAC-Based and Time-Based One-Time Password (HOTP and TOTP) library for Go. Implements RFC 4226 and RFC 6238. Contents Supported Operations Read

Jose Torres 47 Dec 19, 2022
goworker is a Go-based background worker that runs 10 to 100,000* times faster than Ruby-based workers.

goworker goworker is a Resque-compatible, Go-based background worker. It allows you to push jobs into a queue using an expressive language like Ruby w

Benjamin Manns 2.7k Jan 6, 2023
A phoenix Chain client based on the go-ethereum fork,the new PoA consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

g_master 14 Apr 28, 2022
A phoenix Chain client based on the go-ethereum fork,the new PoS consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

null 9 Aug 18, 2022
Go-based search engine URL collector , support Google, Bing, can be based on Google syntax batch collection URL

Go-based search engine URL collector , support Google, Bing, can be based on Google syntax batch collection URL

Re 62 Nov 9, 2022
Small CLI based programs for solving structural engineering design problems based on the book 'Structural Concrete'

Small CLI based programs for solving structural engineering design problems based on the book 'Structural Concrete' written by M. Nadim Hassoun and Akhtem Al-Manaseer (edition-6)

Muhammad Usman Shamsi 1 Nov 26, 2021
crud is a cobra based CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service documentation and k8s deployment manifests

crud crud is a CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service docum

Piyush Jajoo 0 Nov 29, 2021
A simple web-based time in/time out intended for home-based workers.

Web-based Time in/Time out About A simple web-based time in/time out intended for home-based workers. Pre-requisite To run the pre-built binary: An in

Raffy Doquenia 0 Dec 16, 2021