aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-03-24 19:20:53 +0100
committerMattias Andrée <m@maandree.se>2026-03-24 19:20:53 +0100
commitfe0ef9cd334d0ad975ed304983597834c87bb43a (patch)
treee86c044035c422f01e116d185386c9ebb3c3db07 /src
parentm fixes (diff)
downloadxpybar-1.21.tar.gz
xpybar-1.21.tar.bz2
xpybar-1.21.tar.xz
Fix dock-to-bottom and enable docking to the left or rightHEAD1.21master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py47
-rw-r--r--src/plugins/alsa.py2
-rw-r--r--src/plugins/application.py2
-rw-r--r--src/plugins/chase.py2
-rw-r--r--src/plugins/clock.py2
-rw-r--r--src/plugins/cpu.py2
-rw-r--r--src/plugins/cpuinfo.py2
-rw-r--r--src/plugins/cpuonline.py2
-rw-r--r--src/plugins/dentrystate.py2
-rw-r--r--src/plugins/df.py2
-rw-r--r--src/plugins/discstats.py2
-rw-r--r--src/plugins/files.py2
-rw-r--r--src/plugins/hdparm.py2
-rw-r--r--src/plugins/ii.py2
-rw-r--r--src/plugins/image.py2
-rw-r--r--src/plugins/inodestate.py2
-rw-r--r--src/plugins/inotify.py2
-rw-r--r--src/plugins/ipaddress.py2
-rw-r--r--src/plugins/kmsg.py2
-rw-r--r--src/plugins/leapsec.py2
-rw-r--r--src/plugins/lid.py2
-rw-r--r--src/plugins/linereader.py2
-rw-r--r--src/plugins/loadavg.py2
-rw-r--r--src/plugins/locks.py2
-rw-r--r--src/plugins/lunar.py2
-rw-r--r--src/plugins/mem.py2
-rw-r--r--src/plugins/menu.py2
-rw-r--r--src/plugins/moc.py2
-rw-r--r--src/plugins/network.py2
-rw-r--r--src/plugins/pacman.py2
-rw-r--r--src/plugins/ping.py2
-rw-r--r--src/plugins/powersupply.py2
-rw-r--r--src/plugins/random.py2
-rw-r--r--src/plugins/ropty.py2
-rw-r--r--src/plugins/snmp.py2
-rw-r--r--src/plugins/snmp6.py2
-rw-r--r--src/plugins/softirqs.py2
-rw-r--r--src/plugins/solar.py2
-rw-r--r--src/plugins/swaps.py2
-rw-r--r--src/plugins/tzclock.py2
-rw-r--r--src/plugins/uname.py2
-rw-r--r--src/plugins/uptime.py2
-rw-r--r--src/plugins/users.py2
-rw-r--r--src/plugins/vmstat.py2
-rw-r--r--src/plugins/weather.py2
-rw-r--r--src/plugins/xdisplay.py2
-rw-r--r--src/plugins/xkb.py2
-rw-r--r--src/restricted-hdparm.c2
-rw-r--r--src/util.py2
-rw-r--r--src/x.py46
50 files changed, 121 insertions, 68 deletions
diff --git a/src/__main__.py b/src/__main__.py
index e3543c4..c2c8216 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
copyright = '''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2026 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,10 +31,12 @@ PROGRAM_VERSION = '1.20'
global OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND
+global WIDTH, XPOS, LEFT, SIDEBAR
global display, outputs, redraw, Bar, start, stop
global conf_opts, config_file, parser
OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 0, True
+WIDTH, XPOS, LEFT, SIDEBAR = 0, 0, True, False
FONT = '-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*'
BACKGROUND, FOREGROUND = (0, 0, 0), (192, 192, 192)
@@ -58,7 +60,7 @@ def start():
feel free to replace this completely
'''
global bar
- bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND)
+ bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND, WIDTH, XPOS, LEFT, SIDEBAR)
bar.map()
def stop():
@@ -90,9 +92,15 @@ class Bar:
@variable width:int The output's pixel width
@variable height:int The output's pixel height
@variable left:int The output's left position
+ @variable top:int The output's top position
@variable ypos:int The position of the panel in relation to either the top or bottom edge of the output
+ @variable xpos:int The position of the panel in relation to either the left or right edge of the output
@variable panel_height:int The panel's height
+ @variable panel_width:int The panel's width
@variable at_top:bool Whether the panel is to be docked to the top of the output, otherwise to the bottom
+ @variable at_left:bool Whether the panel is to be docked to the left edge of the output, otherwise to the right edge
+ @variable sidebar:bool If `True`, the bar will be docked to the left or right edge,
+ otherwise it will be docked to the top or the bottom edge
@variable background The default background
@variable foreground The default foreground
@@ -104,22 +112,43 @@ class Bar:
@variable cmap_cache Custom colour map cache
'''
- def __init__(self, output, height, ypos, top, font, background, foreground):
+ def __init__(self, output, height, ypos, top, font, background, foreground, width = 0, xpos = 0, left = True, sidebar = False):
'''
Constructor
- @param output:int The index of the output within the screen as printed by xrandr, except primary is first
- @param height:int The height of the panel
- @param ypos:int The position of the panel in relation the either the top or bottom edge of the output
- @param top:bool Whether the panel is to be docked to the top of the output, otherwise to the bottom
+ @param output:int The index of the output within the screen as printed by xrandr,
+ except primary is first
+ @param height:int The height of the panel, 0 to span the entire output if `sidebar`,
+ if negative, the absolute value is subtracted with the output's height
+ @param ypos:int The position of the panel in relation the either the top or bottom
+ edge of the output
+ @param top:bool Whether the panel is to be docked to the top of the output,
+ otherwise to the bottom
@param font:str The default font
@param background:(red:int, green:int, blue:int) The default background
@param foreground:(red:int, green:int, blue:int) The default foreground
+ @param width:int The width of the panel, 0 to span the entire output unless `sidebar`,
+ if negative, the absolute value is subtracted with the output's width
+ @param xpos:int The position of the panel in relation the either the left or right
+ edge of the output
+ @param left:bool Whether the panel is to be docked to the left edge of the output,
+ otherwise to the right edge
+ @param sidebar:bool If `True`, the bar will be docked to the left or right edge,
+ otherwise it will be docked to the top or the bottom edge
'''
## Panel position
- pos = outputs[output][:3] + [ypos, height, top]
- self.width, self.height, self.left, self.ypos, self.panel_height, self.at_top = pos
+ self.width, self.height, self.left, self.top = outputs[output]
+ self.xpos, self.ypos, self.panel_width, self.panel_height = xpos, ypos, width, height
+ self.at_top, self.at_left, self.sidebar = top, left, sidebar
+ if sidebar:
+ if self.panel_height <= 0:
+ self.panel_height += self.height
+ else:
+ if self.panel_width <= 0:
+ self.panel_width += self.width
## Create window and create/fetch resources
+ pos = [self.width, self.height, self.left, self.ypos, self.panel_height, self.at_top]
+ pos += [self.top, self.xpos, self.panel_width, self.at_left, self.sidebar]
self.window = create_panel(*pos)
self.gc = self.window.create_gc()
self.cmap = self.window.get_attributes().colormap
diff --git a/src/plugins/alsa.py b/src/plugins/alsa.py
index 456326f..a4e5b35 100644
--- a/src/plugins/alsa.py
+++ b/src/plugins/alsa.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/application.py b/src/plugins/application.py
index d7f0c88..188d5cb 100644
--- a/src/plugins/application.py
+++ b/src/plugins/application.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/chase.py b/src/plugins/chase.py
index 30a47ea..e8ee5dc 100644
--- a/src/plugins/chase.py
+++ b/src/plugins/chase.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/clock.py b/src/plugins/clock.py
index a3d7bf3..700db78 100644
--- a/src/plugins/clock.py
+++ b/src/plugins/clock.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/cpu.py b/src/plugins/cpu.py
index 21bc70b..4919856 100644
--- a/src/plugins/cpu.py
+++ b/src/plugins/cpu.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/cpuinfo.py b/src/plugins/cpuinfo.py
index 4422f6e..374044e 100644
--- a/src/plugins/cpuinfo.py
+++ b/src/plugins/cpuinfo.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/cpuonline.py b/src/plugins/cpuonline.py
index c358427..39d31e8 100644
--- a/src/plugins/cpuonline.py
+++ b/src/plugins/cpuonline.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/dentrystate.py b/src/plugins/dentrystate.py
index c433ff0..b91af5b 100644
--- a/src/plugins/dentrystate.py
+++ b/src/plugins/dentrystate.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/df.py b/src/plugins/df.py
index 1eb9b90..5d98a45 100644
--- a/src/plugins/df.py
+++ b/src/plugins/df.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/discstats.py b/src/plugins/discstats.py
index 765948a..91b5c38 100644
--- a/src/plugins/discstats.py
+++ b/src/plugins/discstats.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/files.py b/src/plugins/files.py
index 5cf4f33..706af33 100644
--- a/src/plugins/files.py
+++ b/src/plugins/files.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/hdparm.py b/src/plugins/hdparm.py
index 4a27410..9854494 100644
--- a/src/plugins/hdparm.py
+++ b/src/plugins/hdparm.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/ii.py b/src/plugins/ii.py
index c0866ae..f833a94 100644
--- a/src/plugins/ii.py
+++ b/src/plugins/ii.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/image.py b/src/plugins/image.py
index 4c019ac..94ddb5c 100644
--- a/src/plugins/image.py
+++ b/src/plugins/image.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/inodestate.py b/src/plugins/inodestate.py
index dde4f68..cd1ec68 100644
--- a/src/plugins/inodestate.py
+++ b/src/plugins/inodestate.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/inotify.py b/src/plugins/inotify.py
index 31ed1b9..644f13d 100644
--- a/src/plugins/inotify.py
+++ b/src/plugins/inotify.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/ipaddress.py b/src/plugins/ipaddress.py
index 8e0e857..bfa3772 100644
--- a/src/plugins/ipaddress.py
+++ b/src/plugins/ipaddress.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/kmsg.py b/src/plugins/kmsg.py
index 86c21ab..180a1e4 100644
--- a/src/plugins/kmsg.py
+++ b/src/plugins/kmsg.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/leapsec.py b/src/plugins/leapsec.py
index 3d8d95f..fef6b20 100644
--- a/src/plugins/leapsec.py
+++ b/src/plugins/leapsec.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/lid.py b/src/plugins/lid.py
index e31949b..e0fcebd 100644
--- a/src/plugins/lid.py
+++ b/src/plugins/lid.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/linereader.py b/src/plugins/linereader.py
index 3e2e7c9..29f49d4 100644
--- a/src/plugins/linereader.py
+++ b/src/plugins/linereader.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/loadavg.py b/src/plugins/loadavg.py
index 050a7b1..d54bb5b 100644
--- a/src/plugins/loadavg.py
+++ b/src/plugins/loadavg.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/locks.py b/src/plugins/locks.py
index 6bde5a6..509c73c 100644
--- a/src/plugins/locks.py
+++ b/src/plugins/locks.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/lunar.py b/src/plugins/lunar.py
index 2916638..a95f879 100644
--- a/src/plugins/lunar.py
+++ b/src/plugins/lunar.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
diff --git a/src/plugins/mem.py b/src/plugins/mem.py
index 93da047..fdcc0bc 100644
--- a/src/plugins/mem.py
+++ b/src/plugins/mem.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/menu.py b/src/plugins/menu.py
index 24fdace..e6b8bfd 100644
--- a/src/plugins/menu.py
+++ b/src/plugins/menu.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/moc.py b/src/plugins/moc.py
index f3187d3..4436a03 100644
--- a/src/plugins/moc.py
+++ b/src/plugins/moc.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/network.py b/src/plugins/network.py
index f3ee4c2..38f9ff2 100644
--- a/src/plugins/network.py
+++ b/src/plugins/network.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/pacman.py b/src/plugins/pacman.py
index 14be8f3..bb7d010 100644
--- a/src/plugins/pacman.py
+++ b/src/plugins/pacman.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/ping.py b/src/plugins/ping.py
index 89df298..9289fa2 100644
--- a/src/plugins/ping.py
+++ b/src/plugins/ping.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/powersupply.py b/src/plugins/powersupply.py
index d7fb8e3..afa1a5c 100644
--- a/src/plugins/powersupply.py
+++ b/src/plugins/powersupply.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/random.py b/src/plugins/random.py
index 95f0d1d..7d7fe93 100644
--- a/src/plugins/random.py
+++ b/src/plugins/random.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/ropty.py b/src/plugins/ropty.py
index 4c0d201..d7ad36e 100644
--- a/src/plugins/ropty.py
+++ b/src/plugins/ropty.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/snmp.py b/src/plugins/snmp.py
index cd937a4..e83d40b 100644
--- a/src/plugins/snmp.py
+++ b/src/plugins/snmp.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/snmp6.py b/src/plugins/snmp6.py
index 00bc395..71b436f 100644
--- a/src/plugins/snmp6.py
+++ b/src/plugins/snmp6.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/softirqs.py b/src/plugins/softirqs.py
index ba512fb..22e1cf0 100644
--- a/src/plugins/softirqs.py
+++ b/src/plugins/softirqs.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/solar.py b/src/plugins/solar.py
index e917270..3078435 100644
--- a/src/plugins/solar.py
+++ b/src/plugins/solar.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/swaps.py b/src/plugins/swaps.py
index 34ace18..61cd6fb 100644
--- a/src/plugins/swaps.py
+++ b/src/plugins/swaps.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/tzclock.py b/src/plugins/tzclock.py
index 8611de3..8ab4bad 100644
--- a/src/plugins/tzclock.py
+++ b/src/plugins/tzclock.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/uname.py b/src/plugins/uname.py
index 93d338b..88d90b7 100644
--- a/src/plugins/uname.py
+++ b/src/plugins/uname.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/uptime.py b/src/plugins/uptime.py
index 5af45b6..0e8f436 100644
--- a/src/plugins/uptime.py
+++ b/src/plugins/uptime.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/users.py b/src/plugins/users.py
index 33008ee..5c65b39 100644
--- a/src/plugins/users.py
+++ b/src/plugins/users.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/vmstat.py b/src/plugins/vmstat.py
index a5dd8ae..b146c55 100644
--- a/src/plugins/vmstat.py
+++ b/src/plugins/vmstat.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/weather.py b/src/plugins/weather.py
index b8a7432..067092b 100644
--- a/src/plugins/weather.py
+++ b/src/plugins/weather.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/xdisplay.py b/src/plugins/xdisplay.py
index 31fb191..1ea2e72 100644
--- a/src/plugins/xdisplay.py
+++ b/src/plugins/xdisplay.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/plugins/xkb.py b/src/plugins/xkb.py
index 40b74c6..c749910 100644
--- a/src/plugins/xkb.py
+++ b/src/plugins/xkb.py
@@ -1,7 +1,7 @@
# -*- python -*-
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/restricted-hdparm.c b/src/restricted-hdparm.c
index ac2bbf2..f2181d0 100644
--- a/src/restricted-hdparm.c
+++ b/src/restricted-hdparm.c
@@ -1,6 +1,6 @@
/**
* xpybar – xmobar replacement written in python
- * Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+ * Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/util.py b/src/util.py
index b9302eb..679c931 100644
--- a/src/util.py
+++ b/src/util.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/x.py b/src/x.py
index 4ea8b08..fdadc4b 100644
--- a/src/x.py
+++ b/src/x.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
'''
xpybar – xmobar replacement written in python
-Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mattias Andrée (m@maandreese)
+Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2026 Mattias Andrée (m@maandree.se)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -126,7 +126,7 @@ def get_override_redirect():
return True
-def create_panel(width, height, left, ypos, panel_height, at_top):
+def create_panel(width, height, left, ypos, panel_height, at_top, top = 0, xpos = 0, panel_width = None, at_left = True, sidebar = False):
'''
Create a docked panel, not mapped yet
@@ -134,29 +134,53 @@ def create_panel(width, height, left, ypos, panel_height, at_top):
@param height:int The height of the output
@param left:int The left position of the output
@param ypos:int The position of the panel in relation to either the top or bottom edge of the output
- @param panel_height:int The height of the panel
+ @param panel_height:int? The height of the panel, `None` for `height`
@param at_top:bool Whether the panel is to be docked to the top of the output, otherwise to the bottom
+ @param top:int The top position of the output
+ @param xpos:int The position of the panel in relation to either the left or right edge of the output
+ @param panel_width:int? The width of the panel, `None` for `width`
+ @param at_left:bool Whether the panel is to be docked to the left edge of the output, otherwise to the right edge
+ @param sidebar:bool If `True`, the panel will be docked to the left or right edge,
+ otherwise it will be docked to the top or the bottom edge
@return The window
'''
global display, screen
- ypos = ypos if at_top else (height - ypos - panel_height)
- window = screen.root.create_window(left, ypos, width, panel_height, 0,
+
+ sw, sh = screen['width_in_pixels'], screen['height_in_pixels']
+
+ if sidebar:
+ if panel_height is None:
+ panel_height = height
+ else:
+ if panel_width is None:
+ panel_width = width
+
+ w, h = panel_width, panel_height
+ y = top + (ypos if at_top else (height - ypos - h))
+ x = left + (xpos if at_left else (width - xpos - w))
+ window = screen.root.create_window(x, y, panel_width, panel_height, 0,
Xlib.X.CopyFromParent,
Xlib.X.InputOutput,
Xlib.X.CopyFromParent,
event_mask = get_event_mask(),
colormap = Xlib.X.CopyFromParent,
override_redirect = get_override_redirect())
-
- top_ = lambda x, y, w, h : [0, 0, y + h, 0, 0, 0, 0, 0, x, x + w - 1, 0, 0]
- bottom_ = lambda x, y, w, h : [0, 0, 0, y + h, 0, 0, 0, 0, 0, 0, x, x + w - 1]
-
+
window.set_wm_name('xpybar')
window.set_wm_icon_name('xpybar')
window.set_wm_class('bar', 'xpybar')
window.set_wm_client_machine(os.uname().nodename)
-
- position = (top_ if at_top else bottom_)(left, ypos, width, panel_height)
+
+ if sidebar:
+ if at_left:
+ position = [x + w, 0, 0, 0, y, y + h - 1, 0, 0, 0, 0, 0, 0]
+ else:
+ position = [0, sw - x, 0, 0, 0, 0, y, y + h - 1, 0, 0, 0, 0]
+ else:
+ if at_top:
+ position = [0, 0, y + h, 0, 0, 0, 0, 0, x, x + w - 1, 0, 0]
+ else:
+ position = [0, 0, 0, sh - y, 0, 0, 0, 0, 0, 0, x, x + w - 1]
_CARD = display.intern_atom("CARDINAL")
_PSTRUT = display.intern_atom("_NET_WM_STRUT_PARTIAL")
_STRUT = display.intern_atom("_NET_WM_STRUT")