diff options
author | Marvin Borner | 2019-06-24 19:16:01 +0200 |
---|---|---|
committer | Marvin Borner | 2019-06-24 19:16:01 +0200 |
commit | 67baaca2ac8d9ef8dbfa60734ab01d14f2a83899 (patch) | |
tree | a21e3837681191661b8e1677f41aaac17dd1b7c1 | |
parent | a1e8a6b482a310ba5e9eebbe28fef663ea66ccd9 (diff) |
Added possibility to use default cursor via xsetroot
-rw-r--r-- | example.ini | 7 | ||||
-rw-r--r-- | freedowm.py | 20 |
2 files changed, 18 insertions, 9 deletions
diff --git a/example.ini b/example.ini index cffeb64..51975d4 100644 --- a/example.ini +++ b/example.ini @@ -2,8 +2,9 @@ ; Debug mode prints more verbose messages DEBUG = 0 -; Cursor theme (int from https://tronche.com/gui/x/xlib/appendix/b/) -CURSOR = 68 +; Cursor theme (int from https://tronche.com/gui/x/xlib/appendix/b/ - e.g. 68) +; set -1 to use default (requires xsetroot) +CURSOR = -1 ; Border width BORDER = 1 @@ -38,7 +39,7 @@ MENU = d ; Exit window manager QUIT = p -; Switch desktops (tags) +; Switch desktops (tags) - 23: Tab TAGSWAP = 23 TAG0 = 0 TAG1 = 1 diff --git a/freedowm.py b/freedowm.py index 5b1fb44..189a81a 100644 --- a/freedowm.py +++ b/freedowm.py @@ -41,13 +41,8 @@ class FreedoWM(object): self.current_monitor = self.zero_coordinate = self.x_center = self.y_center = 0 self.monitor_count = 1 - # Set cursor - font = self.display.open_font('cursor') - cursor = font.create_glyph_cursor(font, int(self.general["CURSOR"]), int(self.general["CURSOR"]) + 1, - (65535, 65535, 65535), (0, 0, 0)) - self.root.change_attributes(cursor=cursor) - self.screen.override_redirect = True + self.set_cursor() self.get_monitors() self.set_listeners() self.root.warp_pointer(0, 0) @@ -86,6 +81,18 @@ class FreedoWM(object): if self.general["DEBUG"] != "0": print(message) + def set_cursor(self): + """ + Sets the cursor according to the config + :return: + """ + if int(self.general["CURSOR"]) != -1: + font = self.display.open_font('cursor') + cursor = font.create_glyph_cursor(font, int(self.general["CURSOR"]), int(self.general["CURSOR"]) + 1, (65535, 65535, 65535), (0, 0, 0)) + self.root.change_attributes(cursor=cursor) + else: + os.system("xsetroot -cursor_name left_ptr") + def get_monitors(self): """ Gets/sets your monitor setup using the Xlib xrandr helper functions @@ -359,6 +366,7 @@ class FreedoWM(object): elif self.event.type == X.KeyPress and self.event.detail == int(self.keys["TERMINAL"]): os.system(self.programs["TERMINAL"] + " &") + # Switch to last used tag/desktop (MOD + Tab) // X11's "tab" keysym is 0, but it's 23 elif self.event.type == X.KeyPress and self.event.detail == int(self.keys["TAGSWAP"]): previous = self.previous_tag self.previous_tag = self.current_tag |