Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd6e544adc | ||
|
|
f2bda0e496 | ||
|
|
fd8b9ba128 | ||
|
|
94aba90f3d | ||
|
|
fa9d9c3425 | ||
|
|
4711c36c56 |
1
Makefile
1
Makefile
@@ -16,6 +16,7 @@ install:
|
||||
cp bin/nwg-drawer /usr/bin
|
||||
|
||||
uninstall:
|
||||
rm -r /usr/share/nwg-drawer
|
||||
rm /usr/bin/nwg-drawer
|
||||
|
||||
run:
|
||||
|
||||
@@ -18,6 +18,8 @@ and `nwggrid`.
|
||||
|
||||
[more screenshots](https://scrot.cloud/album/nwg-drawer.Bogd) | [see on YouTube](https://youtu.be/iIgxJQhCQf0)
|
||||
|
||||
[](https://repology.org/project/nwg-drawer/versions)
|
||||
|
||||
## Installation
|
||||
|
||||
### Dependencies
|
||||
@@ -62,7 +64,7 @@ Usage of nwg-drawer:
|
||||
-lang string
|
||||
force lang, e.g. "en", "pl"
|
||||
-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
|
||||
use OVerLay layer
|
||||
-s string
|
||||
|
||||
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/nwg-piotr/nwg-menu
|
||||
module github.com/nwg-piotr/nwg-drawer
|
||||
|
||||
go 1.16
|
||||
|
||||
|
||||
65
main.go
65
main.go
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/gotk3/gotk3/gtk"
|
||||
)
|
||||
|
||||
const version = "0.1.0"
|
||||
const version = "0.1.2"
|
||||
|
||||
var (
|
||||
appDirs []string
|
||||
@@ -98,7 +98,7 @@ var (
|
||||
|
||||
// Flags
|
||||
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 overlay = flag.Bool("ovl", false, "use OVerLay layer")
|
||||
var iconSize = flag.Int("is", 64, "Icon Size")
|
||||
@@ -204,35 +204,37 @@ func main() {
|
||||
log.Fatal("Unable to create window:", err)
|
||||
}
|
||||
|
||||
layershell.InitForWindow(win)
|
||||
if wayland() {
|
||||
layershell.InitForWindow(win)
|
||||
|
||||
var output2mon map[string]*gdk.Monitor
|
||||
if *targetOutput != "" {
|
||||
// We want to assign layershell to a monitor, but we only know the output name!
|
||||
output2mon, err = mapOutputs()
|
||||
if err == nil {
|
||||
monitor := output2mon[*targetOutput]
|
||||
layershell.SetMonitor(win, monitor)
|
||||
var output2mon map[string]*gdk.Monitor
|
||||
if *targetOutput != "" {
|
||||
// We want to assign layershell to a monitor, but we only know the output name!
|
||||
output2mon, err = mapOutputs()
|
||||
if err == nil {
|
||||
monitor := output2mon[*targetOutput]
|
||||
layershell.SetMonitor(win, monitor)
|
||||
|
||||
} else {
|
||||
println(err)
|
||||
} else {
|
||||
println(err)
|
||||
}
|
||||
}
|
||||
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_BOTTOM, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_TOP, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_LEFT, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_RIGHT, true)
|
||||
|
||||
if *overlay {
|
||||
layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_OVERLAY)
|
||||
layershell.SetExclusiveZone(win, -1)
|
||||
} else {
|
||||
layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_TOP)
|
||||
}
|
||||
|
||||
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
|
||||
}
|
||||
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_BOTTOM, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_TOP, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_LEFT, true)
|
||||
layershell.SetAnchor(win, layershell.LAYER_SHELL_EDGE_RIGHT, true)
|
||||
|
||||
if *overlay {
|
||||
layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_OVERLAY)
|
||||
layershell.SetExclusiveZone(win, -1)
|
||||
} else {
|
||||
layershell.SetLayer(win, layershell.LAYER_SHELL_LAYER_TOP)
|
||||
}
|
||||
|
||||
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
|
||||
|
||||
win.Connect("destroy", func() {
|
||||
gtk.MainQuit()
|
||||
})
|
||||
@@ -274,6 +276,17 @@ func main() {
|
||||
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
|
||||
outerVBox, _ := gtk.BoxNew(gtk.ORIENTATION_VERTICAL, 0)
|
||||
win.Add(outerVBox)
|
||||
|
||||
6
tools.go
6
tools.go
@@ -20,6 +20,10 @@ import (
|
||||
"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.
|
||||
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() {
|
||||
path := filepath.Join(getDataHome(), "nwg-menu/desktop-directories")
|
||||
path := filepath.Join(getDataHome(), "nwg-drawer/desktop-directories")
|
||||
var other category
|
||||
|
||||
for _, cName := range categoryNames {
|
||||
|
||||
Reference in New Issue
Block a user