6 Commits

Author SHA1 Message Date
piotr
cd6e544adc wrong resources path fixed 2021-06-26 23:45:46 +02:00
piotr
f2bda0e496 bump to 0.1.1 2021-06-23 02:55:02 +02:00
piotr
fd8b9ba128 uninstall fixed 2021-06-23 02:53:56 +02:00
Piotr Miller
94aba90f3d Merge pull request #3 from nwg-piotr/sammiev
basic X11 support
2021-06-23 02:48:14 +02:00
piotr
fa9d9c3425 basic X11 support 2021-06-23 02:44:56 +02:00
Piotr Miller
4711c36c56 Update README.md 2021-06-22 12:00:15 +02:00
6 changed files with 49 additions and 29 deletions

View File

@@ -16,6 +16,7 @@ install:
cp bin/nwg-drawer /usr/bin cp bin/nwg-drawer /usr/bin
uninstall: uninstall:
rm -r /usr/share/nwg-drawer
rm /usr/bin/nwg-drawer rm /usr/bin/nwg-drawer
run: run:

View File

@@ -18,6 +18,8 @@ and `nwggrid`.
[more screenshots](https://scrot.cloud/album/nwg-drawer.Bogd) | [see on YouTube](https://youtu.be/iIgxJQhCQf0) [more screenshots](https://scrot.cloud/album/nwg-drawer.Bogd) | [see on YouTube](https://youtu.be/iIgxJQhCQf0)
[![Packaging status](https://repology.org/badge/vertical-allrepos/nwg-drawer.svg)](https://repology.org/project/nwg-drawer/versions)
## Installation ## Installation
### Dependencies ### Dependencies
@@ -62,7 +64,7 @@ Usage of nwg-drawer:
-lang string -lang string
force lang, e.g. "en", "pl" force lang, e.g. "en", "pl"
-o string -o string
name of the Output to display the menu on (sway only) name of the Output to display the drawer on (sway only)
-ovl -ovl
use OVerLay layer use OVerLay layer
-s string -s string

Binary file not shown.

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/nwg-piotr/nwg-menu module github.com/nwg-piotr/nwg-drawer
go 1.16 go 1.16

17
main.go
View File

@@ -19,7 +19,7 @@ import (
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
) )
const version = "0.1.0" const version = "0.1.2"
var ( var (
appDirs []string appDirs []string
@@ -98,7 +98,7 @@ var (
// Flags // Flags
var cssFileName = flag.String("s", "drawer.css", "Styling: css file name") var cssFileName = flag.String("s", "drawer.css", "Styling: css file name")
var targetOutput = flag.String("o", "", "name of the Output to display the menu on (sway only)") var targetOutput = flag.String("o", "", "name of the Output to display the drawer on (sway only)")
var displayVersion = flag.Bool("v", false, "display Version information") var displayVersion = flag.Bool("v", false, "display Version information")
var overlay = flag.Bool("ovl", false, "use OVerLay layer") var overlay = flag.Bool("ovl", false, "use OVerLay layer")
var iconSize = flag.Int("is", 64, "Icon Size") var iconSize = flag.Int("is", 64, "Icon Size")
@@ -204,6 +204,7 @@ func main() {
log.Fatal("Unable to create window:", err) log.Fatal("Unable to create window:", err)
} }
if wayland() {
layershell.InitForWindow(win) layershell.InitForWindow(win)
var output2mon map[string]*gdk.Monitor var output2mon map[string]*gdk.Monitor
@@ -232,6 +233,7 @@ func main() {
} }
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE) layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
}
win.Connect("destroy", func() { win.Connect("destroy", func() {
gtk.MainQuit() gtk.MainQuit()
@@ -274,6 +276,17 @@ func main() {
cancelClose() cancelClose()
}) })
/*
In case someone REALLY needed to use X11 - for some stupid Zoom meeting or something, this allows
the drawer to behave properly on Openbox, and possibly somewhere else. For sure not on i3.
This feature is not really supported and will stay undocumented.
*/
if !wayland() {
println("Not Wayland, oh really?")
win.SetDecorated(false)
win.Maximize()
}
// Set up UI // Set up UI
outerVBox, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0) outerVBox, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0)
win.Add(outerVBox) win.Add(outerVBox)

View File

@@ -20,6 +20,10 @@ import (
"github.com/joshuarubin/go-sway" "github.com/joshuarubin/go-sway"
) )
func wayland() bool {
return os.Getenv("WAYLAND_DISPLAY") != "" || os.Getenv("XDG_SESSION_TYPE") == "wayland"
}
/* /*
Window leave-notify-event event quits the program with glib Timeout 500 ms. Window leave-notify-event event quits the program with glib Timeout 500 ms.
We might have left the window by accident, so let's clear the timeout if window re-entered. We might have left the window by accident, so let's clear the timeout if window re-entered.
@@ -264,7 +268,7 @@ func listDesktopFiles() []string {
} }
func setUpCategories() { func setUpCategories() {
path := filepath.Join(getDataHome(), "nwg-menu/desktop-directories") path := filepath.Join(getDataHome(), "nwg-drawer/desktop-directories")
var other category var other category
for _, cName := range categoryNames { for _, cName := range categoryNames {